Implements interfaces:
Rdo Mapper class. Controls mapping of entity obects (instances of Horde_Rdo_Base) from and to Horde_Rdo_Adapters.
Public properties: $adapter - Horde_Rdo_Adapter that stores this Mapper's objects.
$inflector - Horde_Rdo_Inflector object for doing table name to class name, class name to table name, etc. conversions.
$model - The Horde_Rdo_Model object describing the main table of this entity.
Located in /Rdo/lib/Horde/Rdo/Mapper.php (line 25)
Class | Description |
---|---|
![]() |
Base Mapper class for Clotho - defines getAdapter() so subclasses stay simple. |
![]() |
|
![]() |
|
![]() |
This class will stand in for our table's Mapper. |
What class should this Mapper create for objects? Defaults to the Mapper subclass' name minus "Mapper". So if the Rdo_Mapper subclass is UserMapper, it will default to trying to create User objects.
Default sorting rules to use for all queries made with this
mapper. Each element of this array can either be a tuple (a single numerically indexed array) of a field name followed by a sort order (Horde_Rdo::SORT_ASC or Horde_Rdo::SORT_DESC), or just a field name. If just a field name is specified the default sorting order (ascending) will be used.
Fields that should only be read from the database when they are accessed.
Relationships that should only be read from the database when they are accessed.
Relationships for this entity.
If this is true and fields named created and updated are present, Rdo will automatically set creation and last updated timestamps. Timestamps are always GMT for portability.
The name of the database table (or view, etc.) that holds this Mapper's objects.
Count objects that match $query.
Create a new object in the backend with $fields as initial values.
Deletes a record from the backend. $object can be either a primary key, an Rdo_Query object, or an Rdo object.
Check if at least one object matches $query.
Find can be called in several ways.
Primary key mode: pass find() a single primary key or an array of primary keys, and it will return either a single object or a Horde_Rdo_List of objects matching those primary keys.
Find mode: otherwise the first argument to find should be a find mode. The defaults modes are Rdo::FIND_FIRST (returns the first object matching the rest of the query), and Rdo::FIND_ALL (return a Horde_Rdo_List of all matches).
When using a find mode, the second argument can be blank (find all objects or the first object depending on find mode), an associative array (keys are fields, values are the values those fields must match exactly), or an Rdo_Query object, which defines arbitrarily complex find rules.
getAdapter() must be overridden by Horde_Rdo_Mapper subclasses if they don't provide $adapter in some other way (by calling setAdapter() or on construction, for example), and there is no global Adapter.
Create an instance of $this->_classname from a set of data.
Associate an adapter with this mapper. Not needed in the general case if getAdapter() is overridden in the concrete Mapper implementation.
Set a default sort field and order for all queries done with this Mapper.
Updates a record in the backend. $object can be either a primary key or an Rdo object. If $object is an Rdo instance then $fields will be ignored as values will be pulled from the object.
Provide read-only, on-demand access to several properties. This method will only be called for properties that aren't already present; once a property is fetched once it is cached and returned directly on any subsequent access.
These properties are available:
adapter: The Horde_Rdo_Adapter this mapper is using to talk to the database.
inflector: The Horde_Rdo_Inflector this mapper uses to translate between PHP class, database table, and database field/key names.
model: The Horde_Rdo_Model object describing the table or view this Mapper manages.
fields: Array of all field names that are loaded up front (eager loading) from the Model.
lazyFields: Array of fields that are only loaded when accessed.
relationships: Array of relationships to other Models.
lazyRelationships: Array of relationships to other Models which are only loaded when accessed.
Documentation generated on Sun, 30 Jan 2011 05:19:30 +0000 by phpDocumentor 1.4.3