Author: ts Date: Thu Dec 20 11:52:09 2007 New Revision: 7032 Log: - Added interface ezcPersistentObjectPropertyConversion.
Added: trunk/PersistentObject/src/interfaces/property_conversion.php (with props) Added: trunk/PersistentObject/src/interfaces/property_conversion.php ============================================================================== --- trunk/PersistentObject/src/interfaces/property_conversion.php (added) +++ trunk/PersistentObject/src/interfaces/property_conversion.php [iso-8859-1] Thu Dec 20 11:52:09 2007 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the ezcPersistentObjectPropertyConversion class. + * + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + * @package PersistentObject + */ + +/** + * Interface that must be implemented by property conversion classes. + * + * This is the base interface that needs to be implemented by property + * conversion classes. A property conversion object can be assigned to a [EMAIL PROTECTED] + * ezcPersistentObjectProperty} instance, to enable automatic manipulation of + * database values. + * + * After a value has been loaded from the database, the [EMAIL PROTECTED] fromDatabase()} + * method will be called, receiving this value, and it's return value will be + * used in the persistent objects property instead of the raw database value. + * Right before storing a persistent object back to the database, the [EMAIL PROTECTED] + * toDatabase()} method will be called, receiving the current property value, + * and the return value of this method will be stored into the database. + * + * The same property conversion object might be assigend to several [EMAIL PROTECTED] + * ezcPersistentObjectProperty} instances to reduce the number of needed + * objects. + * + * @package PersistentObject + * @version //autogen// + */ +interface ezcPersistentObjectPropertyConversion +{ + /** + * Converts the database value given to the property value. + * + * This method is called right after a column value has been read from the + * database, given the $databaseValue. The value returned by this method is + * then assigned to the persistent objects property. + * + * @param mixed $databaseValue Column value. + * @return mixed Property value. + */ + public function fromDatabase( $databaseValue ); + + /** + * Converts the object value given back to the database value. + * + * This method is called right before a property value is written to the + * database, given the $propertyValue. The value returned by this method is + * then written back to the database. + * + * @param mixed $propertyValue Property value. + * @return mixed Column value. + */ + public function toDatabase( $propertyValue ); + + /** + * Method for de-serialization after var_export(). + * + * This methid must be implemented to allow proper de-serialization of + * conversion objects, when they are exported using [EMAIL PROTECTED] var_export()}. + * + * @param array $state + * @return ezcPersistentObjectPropertyConversion + */ + public static function __set_state( array $state ); + +} + +?> Propchange: trunk/PersistentObject/src/interfaces/property_conversion.php ------------------------------------------------------------------------------ svn:eol-style = native -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components