In my Symfony 3 project, I have a ManyToMany relation between "users" and "roles".
It used to work, but now I have an error:
Property AppBundle\Entity\Role::$user does not exist
I don't know what I did, probably it's because of running a "php bin/console doctrine:mapping:import --force AppBundle xml" command.
Here is a fragment of the User entity class:
/**
* @ORM\Table(name="user")
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
*/
class User implements AdvancedUserInterface, \Serializable {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
*
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Role", cascade = {"persist"})
* @ORM\JoinTable(name="user_role")
*/
private $roles;
As you can see there is a relation to the Role entity.
Role entity on the other hand doesn't contain any relation information, and it should work according to this article:
https://knpuniversity.com/screencast/symfony2-ep3/many-to-many-relationship
and it used to work, and now it doesn't and have no idea why.
As far as I understand it, this is named 'unidirectional ManyToMany" relation according to Symfony docs. And for me everything looks fine.