Hello, For the first time, I need ManyToMany mappings.
Assuming below: 1. I want to connect many admins to many departments. 2. Many departments may have one or many admins. 3. Some admins may not be associated with any department. I did read the manual: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#many-to-many-bidirectional http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#owning-and-inverse-side-on-a-manytomany-association So if I understand correctly, Admin is the owning side and Department is inverse side? right? Then below mapping is correct? Please advice. and also in which one should I remove cascade? admin: $metadata->mapManyToMany(array( 'fieldName' => 'departments', 'targetEntity' => 'Department', 'cascade' => array('persist','merge'), 'inversedBy' => 'admins' ) ); department: $metadata->mapManyToMany(array( 'fieldName' => 'admins', 'targetEntity' => 'Admin', 'cascade' => array('persist','merge'), 'mappedBy' => 'departments' ) ); -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
