Answer the question
In order to leave comments, you need to log in
How to filter objects by ManyToMany relationship in Doctrine?
There is an object that has an editors link, which defines users who have rights to edit this object.
Communication is defined in the standard way:
// app/src/MyBundle/Entity/Object.php
/**
* @ORM\ManyToMany(targetEntity="User")
* @ORM\JoinTable(name="object_redactors)
*/
private $redactor
Answer the question
In order to leave comments, you need to log in
I think the point is clear:
Object.php
/**
* @ORM\ManyToMany(targetEntity="User", inversedBy="objects")
* @ORM\JoinTable(name="objects_redactors")
*/
protected $redactors;
/**
* @ORM\ManyToMany(targetEntity="Object", mappedBy="redactors")
*/
protected $objects;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question