Answer the question
In order to leave comments, you need to log in
How to fix error when generating CRUD in Symfony2?
Hello, there is a problem when changing an entity via CRUD in symfony2, I generated a crud, I didn’t touch anything, I go to /admin/post/1/edit and I get an error:
The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class SomeHelp\UserBundle\Entity\UserEntity. You can avoid this error by setting the "data_class" option to "SomeHelp\UserBundle\Entity\UserEntity" or by adding a view transformer that transforms an instance of class SomeHelp\UserBundle\Entity\UserEntity to scalar, array or an instance of \ArrayAccess.
/**
* @ORM\ManyToOne(targetEntity="SomeHelp\UserBundle\Entity\UserEntity",inversedBy="user",cascade={"persist", "remove"})
*/
protected $user;
Answer the question
In order to leave comments, you need to log in
You need to create a form class for UserEntity or remove this field from the main form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question