Property | Type | Description | |
---|---|---|---|
$_classname | string | 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. | |
$_defaultSort | string | Default sorting rule to use for all queries made with this mapper. This is a SQL ORDER BY fragment (without 'ORDER BY'). | |
$_factory | Horde_Rdo_Factory | The caching factory, if used | |
$_lazyFields | array | Fields that should only be read from the database when they are accessed. | |
$_lazyRelationships | array | Relationships that should only be read from the database when they are accessed. | |
$_relationships | array | Relationships for this entity. | |
$_setTimestamps | boolean | Timestamps are always GMT for portability. | |
$_tableDefinition | Horde_Db_Adapter_Base_TableDefinition | The definition of the database table (or view, etc.) that holds this Mapper's objects. |
Method | Description | |
---|---|---|
__construct ( Horde_Db_Adapter $adapter ) | ||
__get ( string $key ) : mixed | 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. | |
addRelation ( string $relationship, Horde_Rdo_Base $ours, Horde_Rdo_Base $theirs ) | Adds a relation. | |
count ( mixed $query = null ) : integer | Count objects that match $query. | |
create ( array $fields ) : Horde_Rdo_Base | Create a new object in the backend with $fields as initial values. | |
delete ( string | Horde_Rdo_Base | Horde_Rdo_Query $object ) : integer | Deletes a record from the backend. $object can be either a primary key, an Rdo_Query object, or an Rdo object. | |
exists ( mixed $query ) : boolean | Check if at least one object matches $query. | |
find ( $arg = null ) | find() can be called in several ways. | |
findOne ( $arg = null ) | findOne can be called in several ways. | |
map ( array $fields = [] ) : Horde_Rdo_Base | Create an instance of $this->_classname from a set of data. | |
mapFields ( Horde_Rdo_Base $object, array $fields = [] ) | Update an instance of $this->_classname from a set of data. | |
mapperToEntity ( ) : string | Transform this mapper's class name to an entity class name. | |
mapperToTable ( ) : string | Transform this mapper's class name to a database table name. | |
removeRelation ( string $relationship, Horde_Rdo_Base $ours, Horde_Rdo_Base $theirs = null ) : integer | Removes a relation to one of the relationships defined in the mapper. | |
setFactory ( Horde_Rdo_Factory $factory = null ) : Horde_Rdo_Mapper | Attach a Horde_Rdo_Factory to the mapper. | |
sortBy ( string $sort ) | Set a default sort rule for all queries done with this Mapper. | |
tableToMapper ( string $table ) : Horde_Rdo_Mapper | Transform a table name to a mapper class name. | |
update ( string | Rdo $object, array $fields = null ) : integer | 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. |
public __construct ( Horde_Db_Adapter $adapter ) | ||
$adapter | Horde_Db_Adapter |
public addRelation ( string $relationship, Horde_Rdo_Base $ours, Horde_Rdo_Base $theirs ) | ||
$relationship | string | The relationship key in the mapper. |
$ours | Horde_Rdo_Base | The object from this mapper to add the relation. |
$theirs | Horde_Rdo_Base | The other object from any mapper to add the relation. |
public find ( $arg = null ) |
public findOne ( $arg = null ) |
public mapperToEntity ( ) : string | ||
return | string | A Horde_Rdo_Base concrete class name if the class exists, else null. |
public mapperToTable ( ) : string | ||
return | string | The database table name. |
public removeRelation ( string $relationship, Horde_Rdo_Base $ours, Horde_Rdo_Base $theirs = null ) : integer | ||
$relationship | string | The relationship key in the mapper. |
$ours | Horde_Rdo_Base | The object from this mapper. |
$theirs | Horde_Rdo_Base | The object to remove from the relation. |
return | integer | the number of affected relations |
public setFactory ( Horde_Rdo_Factory $factory = null ) : Horde_Rdo_Mapper | ||
$factory | Horde_Rdo_Factory | A Factory instance or null |
return | Horde_Rdo_Mapper | this mapper |
public tableToMapper ( string $table ) : Horde_Rdo_Mapper | ||
$table | string | The database table name to look up. |
return | Horde_Rdo_Mapper | A new Mapper instance if it exists, else null. |
protected string $_classname | ||
return | string |
protected string $_defaultSort | ||
return | string |
protected Horde_Rdo_Factory $_factory | ||
return | Horde_Rdo_Factory |
protected array $_lazyFields | ||
return | array |
protected array $_lazyRelationships | ||
return | array |
protected array $_relationships | ||
return | array |
protected bool $_setTimestamps | ||
return | boolean |