To summarize my previous two emails with correction:

Reading manual if I understood correctly, Admin should be owning side and 
Department is reverse side and joinColumn must be in owning side that is 
Admin? Am I correct?

And are mappings below correct?

Department:
$metadata->mapManyToMany(array('fieldName' => 'admins', 
                               'targetEntity' => 'Admin', 
                               'cascade' => array('persist','merge'), 
                               'mappedBy' => 'departments'
                              )
                         );
Admin.php:
$metadata->mapManyToMany(array('fieldName' => 'departments', 
                               'targetEntity' => 'Department', 
                               'cascade' => array('persist','merge'), 
                               'inversedBy' => 'admins',
                               'joinTable' => array( 'name' => 
'admin_to_departments', 
                                                      'schema' => NULL, 
                                                      'joinColumns' => 
array( 0 => array( 'name' => 'admin_id',
                                                                                
          
'referencedColumnName' => 'admin_id', 
                                                                                
          
'nullable' => true, 
                                                                                
          
'columnDefinition' => NULL, 
                                                                            
),), 
                                                     'inverseJoinColumns' 
=> array( 0 => array( 'name' => 'department_id', 
                                                                                
                
'referencedColumnName' => 'id', 
                                                                                
                
'nullable' => true, 
                                                                                
                
'onDelete' => 'cascade', 
                                                                                
                
'columnDefinition' => NULL, 
                                                                                
     
), ), 
                                                     ), 
                               )
                         );

Please advice if I am in correct path?

-- 
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.

Reply via email to