Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcPersistentPropertyConverter

PersistentObject::ezcPersistentPropertyConverter

Interface ezcPersistentPropertyConverter

Interface that must be implemented by property converter classes.

This is the base interface that needs to be implemented by property converter classes. A property converter object can be assigned to a ezcPersistentObjectProperty instance, to enable automatic manipulation of database values.

After a value has been loaded from the database, the 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 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 converter object might be assigend to several ezcPersistentObjectProperty instances to reduce the number of needed objects.

Source for this file: /PersistentObject/src/interfaces/property_converter.php

Version:   //autogen//

Method Summary

public static ezcPersistentPropertyConverter __set_state( $state )
Method for de-serialization after var_export().
public mixed fromDatabase( $databaseValue )
Converts the database value given to the property value.
public mixed toDatabase( $propertyValue )
Converts the object value given back to the database value.

Methods

__set_state

static ezcPersistentPropertyConverter __set_state( $state )

Method for de-serialization after var_export().

This methid must be implemented to allow proper de-serialization of converter objects, when they are exported using http://www.php.net/var_export.

Parameters:
Name Type Description
$state array

fromDatabase

mixed fromDatabase( mixed $databaseValue )

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.

For all implementations it should be made sure, that null is accepted and handled correctly here, to indicate that the database field contained a null value.

Parameters:
Name Type Description
$databaseValue mixed Column value.

toDatabase

mixed toDatabase( mixed $propertyValue )

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.

Cases where fields may be left empty (null) should always be considered in this method, The default way to handle a null value should be to return null again, except if excplicitly desired differently.

Parameters:
Name Type Description
$propertyValue mixed Property value.
Documentation generated by phpDocumentor 1.4.3