PHP 클래스 Horde_Rdo_Base, horde

상속: implements IteratorAggregate, implements ArrayAccess
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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