Author: jwage Date: 2008-08-26 22:24:20 +0100 (Tue, 26 Aug 2008) New Revision: 4817
Modified: branches/1.0/docs/manual/en/working-with-objects.txt Log: docs Modified: branches/1.0/docs/manual/en/working-with-objects.txt =================================================================== --- branches/1.0/docs/manual/en/working-with-objects.txt 2008-08-26 21:17:30 UTC (rev 4816) +++ branches/1.0/docs/manual/en/working-with-objects.txt 2008-08-26 21:24:20 UTC (rev 4817) @@ -1,8 +1,13 @@ ++ Dealing with relations + ++ Many-to-Many relations + +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. + +++ Creating a new link -Lets say we have two classes User and Group which are linked trhough a GroupUser association class. When working with -transient (new) records the fastest way for adding a User and couple of Groups for it is: + +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: + <code type="php"> $user = new User(); $user->name = 'Some User'; @@ -11,8 +16,8 @@ $user->save(); </code> -However in real world scenarious you often already have existing groups, where you want to add a given user. The most -efficient way of doing this is: +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: + <code type="php"> $gu = new GroupUser(); $gu->user_id = $userId; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "doctrine-svn" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.co.uk/group/doctrine-svn?hl=en-GB -~----------~----~----~----~------~----~------~--~---
