Author: Frederik Holljen Date: 2007-02-09 08:07:09 +0100 (Fri, 09 Feb 2007) New Revision: 4642
Log: - updated tutorial Modified: trunk/PersistentObject/docs/tutorial.txt Modified: trunk/PersistentObject/docs/tutorial.txt =================================================================== --- trunk/PersistentObject/docs/tutorial.txt 2007-02-08 20:04:26 UTC (rev 4641) +++ trunk/PersistentObject/docs/tutorial.txt 2007-02-09 07:07:09 UTC (rev 4642) @@ -11,7 +11,10 @@ inheritance structure to work. PersistentObject is built to be fast and flexible, allowing you to build -persistent classes in the same way as any other class in your application. +persistent classes in the same way as any other class in your application. It +also utilizes the query abstraction layer of the Database component to make it +easy to build queries. Please refer to the API documentation of ezcDatabase for +detailed examples on how to use the query abstraction layer. The PersistentObjectDatabaseSchemaTiein component allows you to automatically generate the definition files needed by PersistentObject from a database schema @@ -247,7 +250,7 @@ The find() method will fetch the complete result set and instantiate it for you. This is not desirable if you are fetching large numbers of objects and you -want it to be fast and efficient. For this you can use the fetchIterator() +want it to be fast and efficient. For this you can use the findIterator() method: :: <?php @@ -267,6 +270,23 @@ only one object will be instantiated and the data will be transferred from the database only when it is needed. +The final example uses a find query with a logical and to find objects: :: + + <?php + $q = $session->createFindQuery( 'Person' ); + $q->where( + $q->expr->lAnd( + $q->expr->eq( 'name', $q->bindValue( 'Guybrush Threepwood' ) ), + $q->expr->eq( 'age', $q->bindValue( 25 ) ) + ) + ); + $objects = $session->findIterator( $q, 'Person' ); + foreach( $objects as $object ) + { + // ... + } + ?> + Deleting objects ----------------- -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components