Changeset 4817 for branches/1.0/docs/manual/en/working-with-objects.txt
- Timestamp:
- 08/26/08 17:24:20 (19 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/docs/manual/en/working-with-objects.txt
r4674 r4817 1 1 ++ Dealing with relations 2 2 3 ++ Many-to-Many relations 4 5 Note: Doctrine requires that Many-to-Many relationships be bi-directional. For example: both User must have many Group and Group must have many User. This is required by Doctrine in order for Many-to-Many relationships to fully work. 6 3 7 +++ Creating a new link 4 Lets say we have two classes User and Group which are linked trhough a GroupUser association class. When working with 5 transient (new) records the fastest way for adding a User and couple of Groups for it is: 8 9 Lets say we have two classes User and Group which are linked through a GroupUser association class. When working with transient (new) records the fastest way for adding a User and couple of Groups for it is: 10 6 11 <code type="php"> 7 12 $user = new User(); … … 12 17 </code> 13 18 14 However in real world scenario us you often already have existing groups, where you want to add a given user. The most15 efficient way of doing this is: 19 However in real world scenarios you often already have existing groups, where you want to add a given user. The most efficient way of doing this is: 20 16 21 <code type="php"> 17 22 $gu = new GroupUser();