Author: Frederik Holljen Date: 2007-01-03 07:17:23 +0100 (Wed, 03 Jan 2007) New Revision: 4453
Log: - updated tutorial to be more clear Modified: trunk/PersistentObject/docs/tutorial.txt Modified: trunk/PersistentObject/docs/tutorial.txt =================================================================== --- trunk/PersistentObject/docs/tutorial.txt 2007-01-02 08:53:28 UTC (rev 4452) +++ trunk/PersistentObject/docs/tutorial.txt 2007-01-03 06:17:23 UTC (rev 4453) @@ -517,6 +517,8 @@ $def->properties['city']->columnName = 'city'; $def->properties['city']->propertyName = 'city'; $def->properties['city']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; + + return $def; ?> Defining a simple relation @@ -575,8 +577,10 @@ new ezcPersistentSingleTableMap( "id", "person_id" - ), + ) ); + + // .. ?> A relation to another persistent object is defined in the property @@ -617,8 +621,10 @@ new ezcPersistentSingleTableMap( "lastname", "person_lastname" - ), + ) ); + + return $def; ?> Using a relation @@ -697,8 +703,10 @@ "persons_addresses" ); $def->relations["Address"]->columnMap = array( - new ezcPersistentDoubleTableMap( "id", "person_id", "address_id", "id" ), + new ezcPersistentDoubleTableMap( "id", "person_id", "address_id", "id" ) ); + + return $def; ?> In contrast to all other implementations of ezcPersistentRelation, the @@ -735,8 +743,10 @@ ); $def->relations["Address"]->columnMap = array( new ezcPersistentDoubleTableMap( "firstname", "person_firstname", "address_id", "id" ), - new ezcPersistentDoubleTableMap( "lastname", "person_lastname", "address_id", "id" ), + new ezcPersistentDoubleTableMap( "lastname", "person_lastname", "address_id", "id" ) ); + + return $def; ?> Using n:m relations @@ -772,7 +782,7 @@ $def->idProperty->propertyName = 'id'; $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' ); - // ... + return $def; ?> And for the relation (defined in the definition file of the Person): :: @@ -788,8 +798,10 @@ new ezcPersistentSingleTableMap( "id", "person_id" - ), + ) ); + + return $def; ?> If you let both tables use an ezcPersistentSequenceGenerator for the same key, @@ -835,6 +847,8 @@ new ezcPersistentDoubleTableMap( "id", "address_id", "person_id", "id" ), ); $def->relations["Address"]->reverse = true; + + return $def; ?> With the relation definition shown above, you would still be able to get the @@ -895,6 +909,8 @@ ), ); $def->relations["Address"]->cascade = true; + + return $def; ?> If you now use :: -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components