into Doctrine 2 Documentation explain Owning Side and Inverse Side into ManyToMany Relationship and said that :
For ManyToMany bidirectional relationships either side may be the owning side (the side that defines the @JoinTable and/or does not make use of the mappedBy attribute, thus using a default join table).
Is That mean I can write my annotation without using inversedBy and mappedBy To refer for Owning Side of ManyToMany Relationship and Inverse Side of ManyToMany Relationship ?
Ex:
can i write that :
Affiliate Entity
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Category")
*
*/
private $categories;
and
Category Entity
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Affiliate")
* @ORM\JoinTable(name="category_affiliate")
*
*/
private $afflitiates;
instead of write that:
Affiliate Entity
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Category", mappedBy="afflitiates")
*
*/
private $categories;
and
Category Entity
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Affiliate",inversedBy="categories")
* @ORM\JoinTable(name="category_affiliate")
*
*/
private $afflitiates;
@ORM\JoinTableis automatically the owning side ... so it's npossible for Doctrine to determine the owning side without needing aninversedByattribute, right? - Nicolai Fröhlich