Lookups are special objects that can be added to an entity type. The allow for runtime generation of values based on the contents of an entity. They also allow setting values back to the entity. There are two different lookups that come with Xyster.
Can generate Zend_Date
objects based on a date field in an entity
Can generate Xyster_Enum
objects based on the value of a field in an entity
The best place to instantiate and add these lookups is the init
method in your mapper classes. You can create your own lookup classes
by implenting Xyster_Orm_Entity_Lookup_Interface.
The date object takes two or three arguments. The type of entity that the lookup supports, the name of the field where the date value is stored, and optionally the name of the property on the entity that will invoke this lookup (by default it's the name of the field appended with 'Date').
When a new Zend_Date
object is stored to
the lookup property, its value will be written to the original
date field on the entity (additionally, you can specify the format).
The enum lookup takes between 3 and 5 arguments. The type of
entity that the lookup supports, a Xyster_Type
object that represents the type of enum class, the name of the
field where the lookup value is stored, optionally a flag for
specifying whether the entity value is used as the enum name or
value, and optionally the name of the property on the entity
that will invoke this lookup (by default it's the name of the
field appended with 'Type').
When a new Xyster_Enum
object is stored
to the lookup property, its value (or name) will be written to
the original value field on the entity.