|
4118 - trunk/PersistentObject/docs [eZComponents: Trunk]: msg#00291web.ezcomponents.cvs
Author: Tobias Schlitt Date: 2006-11-28 19:43:28 +0100 (Tue, 28 Nov 2006) New Revision: 4118 Log: - Finished task #9574: Documentation for ezcPersistentManualGenerator is missing. Modified: trunk/PersistentObject/docs/tutorial.txt Modified: trunk/PersistentObject/docs/tutorial.txt =================================================================== --- trunk/PersistentObject/docs/tutorial.txt 2006-11-28 18:28:08 UTC (rev 4117) +++ trunk/PersistentObject/docs/tutorial.txt 2006-11-28 18:43:28 UTC (rev 4118) @@ -328,7 +328,46 @@ ); ?> +ezcPersistentManualGenerator +---------------------------- +If you do not rely on a database mechanism to generate values for a primary +key column, you have to use the ezcPersistentManualGenerator class. You can +then set the value of the ID property by hand and save the object afterwards. + +For example: :: + + CREATE TABLE persons + ( + login varchar(25), + full_name varchar(255), + age integer, + PRIMARY KEY (login) + ); + +In this table you use a string value as the primary key and therefore have to +generate ID values manually. Use the following definition: :: + + <?php + $def->idProperty->generator = new ezcPersistentGeneratorDefinition( + 'ezcPersistentManualGenerator' + ); + ?> + +And for saving a new instance the following code: :: + + <?php + $object = new Person(); + + // Manually set the ID + $object->login = "guybrush"; + + $object->name = "Guybrush Threepwood"; + $object->age = 31; + + $session->save( $object ); + ?> + Definition loaders =================== |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | 4117 - trunk/ImageConversion/src/interfaces [eZComponents: Trunk]: 00291, Tobias Schlitt |
|---|---|
| Next by Date: | 4119 - trunk/PersistentObject/docs [eZComponents: Trunk]: 00291, Tobias Schlitt |
| Previous by Thread: | 4117 - trunk/ImageConversion/src/interfaces [eZComponents: Trunk]i: 00291, Tobias Schlitt |
| Next by Thread: | 4119 - trunk/PersistentObject/docs [eZComponents: Trunk]: 00291, Tobias Schlitt |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |