PHP Класс Horde_Rdo_Base, horde

Наследование: implements IteratorAggregate, implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_fields array This object's fields.
$_mapper Horde_Rdo_Mapper The Horde_Rdo_Mapper instance associated with this Rdo object. The Mapper takes care of all backend access.

Открытые методы

Метод Описание
__clone ( ) When Rdo objects are cloned, unset the unique id that identifies them so that they can be modified and saved to the backend as new objects. If you don't really want a new object, don't clone.
__construct ( array $fields = [] ) Constructor. Can be called directly by a programmer, or is called in Horde_Rdo_Mapper::map(). Takes an associative array of initial object values.
__get ( string $field ) : mixed Fetch fields that haven't yet been loaded. Lazy-loaded fields and lazy-loaded relationships are handled this way. Once a field is retrieved, it is cached in the $_fields array so it doesn't need to be fetched again.
__isset ( string $field ) Allow using isset($rdo->foo) to check for field or relationship presence.
__set ( string $field, mixed $value ) Set a field's value.
__unset ( string $field ) Allow using unset($rdo->foo) to unset a basic field. Relationships cannot be unset in this way.
addRelation ( string $relationship, Horde_Rdo_Base $peer ) Adds a relation to one of the relationships defined in the mapper.
delete ( ) : boolean Delete this object from the backend.
getIterator ( ) : Horde_Rdo_Iterator Implement the IteratorAggregate interface. Looping over an Rdo object goes through each property of the object in turn.
getMapper ( ) : Horde_Rdo_Mapper Get a Mapper instance that can be used to manage this object. The Mapper instance can come from a few places:
hasRelation ( string $relationship, Horde_Rdo_Base $peer = null ) : boolean Checks whether a relation to a peer is defined through one of the relationships in the mapper.
offsetExists ( $field ) Implements isset() for ArrayAccess interface.
offsetGet ( $field ) Implements getter for ArrayAccess interface.
offsetSet ( $field, $value ) Implements setter for ArrayAccess interface.
offsetUnset ( $field ) Implements unset() for ArrayAccess interface.
removeRelation ( string $relationship, Horde_Rdo_Base $peer = null ) : integer Removes a relation to one of the relationships defined in the mapper.
save ( ) : boolean Save any changes to the backend.
setFields ( array $fields = [] ) Set field values for the object
setMapper ( Horde_Rdo_Mapper $mapper ) Associate this Rdo object with the Mapper instance that will manage it. Called automatically by Horde_Rdo_Mapper:map().
toArray ( boolean $lazy = false, boolean $relationships = false ) : array Converts the entity to an Array.

Защищенные методы

Метод Описание
_fillPlaceholders ( array $query ) : array Take a query array and replace @field@ placeholders with values from this object.

Описание методов

__clone() публичный Метод

When Rdo objects are cloned, unset the unique id that identifies them so that they can be modified and saved to the backend as new objects. If you don't really want a new object, don't clone.
public __clone ( )

__construct() публичный Метод

Constructor. Can be called directly by a programmer, or is called in Horde_Rdo_Mapper::map(). Takes an associative array of initial object values.
См. также: Horde_Rdo_Mapper::map()
public __construct ( array $fields = [] )
$fields array Initial values for the new object.

__get() публичный Метод

Fetch fields that haven't yet been loaded. Lazy-loaded fields and lazy-loaded relationships are handled this way. Once a field is retrieved, it is cached in the $_fields array so it doesn't need to be fetched again.
public __get ( string $field ) : mixed
$field string The name of the field to access.
Результат mixed The value of $field or null.

__isset() публичный Метод

Allow using isset($rdo->foo) to check for field or relationship presence.
public __isset ( string $field )
$field string The field name to check existence of.

__set() публичный Метод

Set a field's value.
public __set ( string $field, mixed $value )
$field string The field to set
$value mixed The field's new value

__unset() публичный Метод

Allow using unset($rdo->foo) to unset a basic field. Relationships cannot be unset in this way.
public __unset ( string $field )
$field string The field name to unset.

_fillPlaceholders() защищенный Метод

Take a query array and replace @field@ placeholders with values from this object.
protected _fillPlaceholders ( array $query ) : array
$query array The query to process placeholders on.
Результат array The query with placeholders filled in.

addRelation() публичный Метод

- For one-to-one relations, simply updates the relation field. - For one-to-many relations, updates the related object's relation field. - For many-to-many relations, adds an entry in the "through" table. - Performs a no-op if the peer is already related. This is a proxy to the mapper's addRelation() method.
public addRelation ( string $relationship, Horde_Rdo_Base $peer )
$relationship string The relationship key in the mapper.
$peer Horde_Rdo_Base The object to add the relation.

delete() публичный Метод

Delete this object from the backend.
public delete ( ) : boolean
Результат boolean Success or failure.

getIterator() публичный Метод

Implement the IteratorAggregate interface. Looping over an Rdo object goes through each property of the object in turn.
public getIterator ( ) : Horde_Rdo_Iterator
Результат Horde_Rdo_Iterator The Iterator instance.

getMapper() публичный Метод

- If the class Mapper exists, it will be used automatically. - Any Rdo instance created with Horde_Rdo_Mapper::map() will have a $mapper object set automatically. - Subclasses can override getMapper() to return the correct mapper object. - The programmer can call $rdoObject->setMapper($mapper) to provide a mapper object. A Horde_Rdo_Exception will be thrown if none of these conditions are met.
public getMapper ( ) : Horde_Rdo_Mapper
Результат Horde_Rdo_Mapper The Mapper instance managing this object.

hasRelation() публичный Метод

Checks whether a relation to a peer is defined through one of the relationships in the mapper.
public hasRelation ( string $relationship, Horde_Rdo_Base $peer = null ) : boolean
$relationship string The relationship key in the mapper.
$peer Horde_Rdo_Base The object to check for the relation. If this is null, check if there is any peer for this relation.
Результат boolean True if related.

offsetExists() публичный Метод

Implements isset() for ArrayAccess interface.
См. также: __isset()
public offsetExists ( $field )

offsetGet() публичный Метод

Implements getter for ArrayAccess interface.
См. также: __get()
public offsetGet ( $field )

offsetSet() публичный Метод

Implements setter for ArrayAccess interface.
См. также: __set()
public offsetSet ( $field, $value )

offsetUnset() публичный Метод

Implements unset() for ArrayAccess interface.
См. также: __unset()
public offsetUnset ( $field )

removeRelation() публичный Метод

- For one-to-one and one-to-many relations, simply sets the relation field to 0. - For many-to-many, either deletes all relations to this object or just the relation to a given peer object. - Performs a no-op if the peer is already unrelated. This is a proxy to the mapper's removeRelation method.
public removeRelation ( string $relationship, Horde_Rdo_Base $peer = null ) : integer
$relationship string The relationship key in the mapper
$peer Horde_Rdo_Base The object to remove from the relation
Результат integer The number of relations affected

save() публичный Метод

Save any changes to the backend.
public save ( ) : boolean
Результат boolean Success.

setFields() публичный Метод

Set field values for the object
См. также: Horde_Rdo_Mapper::map()
public setFields ( array $fields = [] )
$fields array Initial values for the new object.

setMapper() публичный Метод

Associate this Rdo object with the Mapper instance that will manage it. Called automatically by Horde_Rdo_Mapper:map().
См. также: Horde_Rdo_Mapper::map()
public setMapper ( Horde_Rdo_Mapper $mapper )
$mapper Horde_Rdo_Mapper The Mapper to manage this Rdo object.

toArray() публичный Метод

This method can be used when handing it over to Horde_Variables so that the database is not unnecessarily queried because of lazyFields/lazyRelationships.
public toArray ( boolean $lazy = false, boolean $relationships = false ) : array
$lazy boolean Whether lazy elements should be added.
$relationships boolean Whether relationships should be added.
Результат array All selected fields and relationships.

Описание свойств

$_fields защищенное свойство

This object's fields.
protected array $_fields
Результат array

$_mapper защищенное свойство

The Horde_Rdo_Mapper instance associated with this Rdo object. The Mapper takes care of all backend access.
См. также: Horde_Rdo_Mapper
protected Horde_Rdo_Mapper $_mapper
Результат Horde_Rdo_Mapper