OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce the form's view data is expected to be an instance of Entity

This topic contains 0 replies, has 1 voice, and was last updated by fudu fudu 1 year ago.

  • Creator
    Topic
  • #37622
    fudu
    fudu
    Participant

    i’m trying to override Form/Type in Symfony-Orocommerce, and at first, i got this error:

    Cannot read index “namePrefix” from object of type
    “Oro\CustomerBundle\Entity\CustomerUser” because it doesn’t implement
    \ArrayAccess.

    And after follow this post,i got another error which i can’t solved :(

    The form’s view data is expected to be an instance of class
    MyCode\Bundle\CustomerBundle\Entity\CustomerUser, but is an instance
    of class Oro\Bundle\CustomerBundle\Entity\CustomerUser. You can avoid
    this error by setting the “data_class” option to null or …

    Here is my code:

    MyCode\Bundle\CustomerBundle\Controller\CustomerUserController.php

    What i’ve done here is i change CustomerUserType to MyCodeCustomerUserType, that’s all.

    CustomerBundle\Resources\config\services.yml

    MyCode\Bundle\CustomerBundle\Form\Type\CustomerUserType.php

    Thanks for reading, have a good day :)
    Here is my stackoverflow post (if you interesting)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No