PHP Класс Doctrine_Record, ZFPlanet

С версии: 1.0
Автор: Konsta Vesterinen ([email protected])
Наследование: extends Doctrine_Record_Abstract, implements Countable, implements IteratorAggregate, implements Serializable
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_customAccessors array Array of custom accessors for cache
$_customMutators array Array of custom mutators for cache
$_data array each element is one of 3 following types: - simple type (int, string) - field has a scalar value - null - field has NULL value in DB - Doctrine_Null - field value is unknown, it wasn't loaded yet
$_errorStack error stack object
$_id integer the primary keys of this object
$_invokedSaveHooks array Array containing the save hooks and events that have been invoked
$_lastModified array an array containing field names that were modified in the previous transaction
$_modified array an array containing field names that have been modified
$_node
$_oldValues array an array of the old values from set properties
$_pendingDeletes string Doctrine_Collection of objects needing to be deleted on save
$_pendingUnlinks array Array of pending un links in format alias => keys to be executed after save
$_references array an array containing all the references
$_serializeReferences boolean Whether or not to serialize references when a Doctrine_Record is serialized
$_state integer the state of this record
$_values array the values array, aggregate values and such are mapped into this array

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

Метод Описание
__call ( string $method, array $args ) : mixed magic method used for method overloading
__construct ( Doctrine_Table | null $table = null, boolean $isNewEntry = false ) constructor
__toString ( ) : string magic method
__unset ( string $name ) : void deletes a column or a related component.
_index ( ) : integer the current instance counter used to generate unique ids for php objects. Contains the next identifier.
assignDefaultValues ( boolean $overwrite = false ) : boolean setDefaultValues sets the default values for records internal data
assignIdentifier ( mixed $id = false ) : void assigns an identifier to the instance, for database storage
assignInheritanceValues ( ) : void Assign the inheritance column values
call ( string | array $callback, string $column ) : Doctrine_Record call
cleanData ( array &$data ) : array cleanData leaves the $data array only with values whose key is a field inside this record and returns the values that were removed from $data. Also converts any values of 'null' to objects of type Doctrine_Null.
clearAccessor ( string $fieldName ) : void clears the accessor for a field name
clearInvokedSaveHooks ( ) makes all the already used save hooks available again
clearMutator ( string $fieldName ) : void clears the custom mutator for a field name
clearRelated ( string $name = null ) : void Clear a related reference or all references
columnCount ( ) : integer alias for @see count()
construct ( ) : void construct Empty template method to provide concrete Record classes with the possibility to hook into the constructor procedure
contains ( string $fieldName ) : boolean test whether a field (column, mapped value, related component) is accessible by @see get()
copy ( boolean $deep = false ) : Doctrine_Record generates a copy of this object. Returns an instance of the same class of $this.
coreSetRelated ( string $name, Doctrine_Record | Doctrine_Collection $value ) Places a related component in the object graph.
count ( ) : integer implements Countable interface
delete ( Doctrine_Connection $conn = null ) : boolean deletes this data access object and all the related composites this operation is isolated by a transaction
deleteNode ( ) used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
errorStack ( $stack = null ) : void | Doctrine_Validator_ErrorStack assigns the ErrorStack or returns it if called without parameters
exists ( ) : boolean returns true if this record is saved in the database, otherwise false (it is transient)
exportTo ( string $type, string $deep = true ) : string exports instance to a chosen format
free ( boolean $deep = false ) Helps freeing the memory occupied by the entity.
fromArray ( array $array, boolean $deep = true ) : void imports data from a php array
get ( mixed $fieldName, boolean $load = true ) : mixed returns a value of a property or a related component
getAccessor ( string $fieldName ) : string gets the custom accessor for a field name
getAccessors ( ) : array gets all accessors for this component instance
getData ( ) : array return all the internal data (columns)
getErrorStack ( ) : Doctrine_Validator_ErrorStack retrieves the ErrorStack. To be called after a failed validation attempt (@see isValid()).
getErrorStackAsString ( ) : string Get the record error stack as a human readable string.
getIncremented ( ) : integer returns the value of autoincremented primary key of this object (if any)
getIterator ( ) : Doctrine_Record_Iterator implements IteratorAggregate interface
getLast ( ) : Doctrine_Record getLast this method is used internally by Doctrine_Query it is needed to provide compatibility between records and collections
getLastModified ( boolean $old = false ) : array returns an array of the modified fields from the last transaction.
getModified ( boolean $old = false, boolean $last = false ) : array retrieves an array of modified fields and associated new values.
getMutator ( $fieldName ) : string gets the custom mutator for a field name
getMutators ( ) : array gets all custom mutators for this component instance
getNode ( ) : Doctrine_Node getter for node associated with this record
getOid ( ) : integer
getPendingDeletes ( ) : array returns Doctrine_Record instances which need to be deleted on save
getPendingUnlinks ( ) : array returns Doctrine_Record instances which need to be unlinked (deleting the relation) on save
getPrepared ( array $array = [] ) : array Retrieves data prepared for a sql transaction.
getReferences ( ) : array get all related components
getTable ( ) : Doctrine_Table returns the table object for this record.
hasAccessor ( string $fieldName, string $accessor = null ) : boolean sets a fieldname to have a custom accessor or check if a field has a custom accessor defined (when called without $accessor parameter).
hasAccessorMutator ( $fieldName, string $accessor, string $mutator ) Set a fieldname to have a custom accessor and mutator
hasMappedValue ( string $name ) : boolean Tests whether a mapped value exists
hasMutator ( string $fieldName, string $mutator = null ) : boolean sets a fieldname to have a custom mutator or check if a field has a custom mutator defined (when called without the $mutator parameter)
hasReference ( string $name ) : boolean tests whether a relation is set
hasRelation ( mixed $fieldName ) : boolean checks existence of properties and related components
hydrate ( array $data, boolean $overwriteLocalChanges = true ) : void hydrate hydrates this object from given array
identifier ( ) : array returns the primary keys of this object
importFrom ( string $type, string $data, $deep = true ) : void imports data from a chosen format in the current instance
invokeSaveHooks ( string $when, string $type, Doctrine_Event $event = null ) : Doctrine_Event calls a subclass hook. Idempotent until @see clearInvokedSaveHooks() is called.
isInProxyState ( ) : boolean indicates whether record has any not loaded fields
isModified ( boolean $deep = false ) : boolean returns true if this record was modified, otherwise false
isValid ( boolean $deep = false, boolean $hooks = true ) : boolean tests validity of the record using the current data.
link ( string $alias, array $ids, boolean $now = false ) : Doctrine_Record creates links from this record to given records
linkInDb ( string $alias, array $ids ) : Doctrine_Record creates links from this record to given records now, querying the db
load ( array $data = [] ) : boolean loads all the uninitialized properties from the database.
loadReference ( string $name ) : void loadReference loads a related component
mapValue ( string $name, mixed $value = null ) : void sets a value that will be managed as if it were a field by magic accessor and mutators, @see get() and @see set().
merge ( $data, boolean $deep = true ) : void merges this record with an array of values or with another existing instance of this object
obtainReference ( string $name ) gets a related component and fails if it does not exist
oid ( )
postDelete ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.
postHydrate ( $event ) Empty template method to provide Record classes with the ability to alter hydration after it runs
postInsert ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be inserted into the data store the first time.
postSave ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure.
postSerialize ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
postUnserialize ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
postUpdate ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be updated.
postValidate ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure.
preDelete ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.
preDqlDelete ( $event ) Empty template method to provide Record classes with the ability to alter DQL delete queries at runtime
preDqlSelect ( $event ) Empty template method to provide Record classes with the ability to alter DQL select queries at runtime
preDqlUpdate ( $event ) Empty template method to provide Record classes with the ability to alter DQL update queries at runtime
preHydrate ( $event ) Empty template method to provide Record classes with the ability to alter hydration before it runs
preInsert ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be inserted into the data store the first time.
preSave ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure.
preSerialize ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
preUnserialize ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
preUpdate ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be updated.
preValidate ( $event ) Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure. Useful for cleaning up data before validating it.
rawGet ( $fieldName ) : mixed returns the value of a property (column). If the property is not yet loaded this method does NOT load it.
reference ( string $name ) : Doctrine_Record | Doctrine_Collection gets a related component
refresh ( boolean $deep = false ) : boolean refresh refresh internal data from the database
refreshRelated ( string $name = null ) : Doctrine_Record refresh refresh data of related objects from the database
relatedExists ( string $name ) : boolean Check if a related relationship exists. Will lazily load the relationship in order to check. If the reference didn't already exist and it doesn't exist in the database, the related reference will be cleared immediately.
replace ( Doctrine_Connection $conn = null ) : integer executes a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
resetPendingUnlinks ( ) : void resets pending record unlinks
save ( Doctrine_Connection $conn = null ) : void applies the changes made to this object into database this method is smart enough to know if any changes are made and whether to use INSERT or UPDATE statement
serialize ( ) : string serialize this method is automatically called when an instance of Doctrine_Record is serialized
serializeReferences ( boolean $bool = null ) : boolean Set whether or not to serialize references.
set ( $fieldName, mixed $value, boolean $load = true ) : Doctrine_Record alters mapped values, properties and related components.
setRelated ( string $alias, Doctrine_Access $coll ) set a related component
setUp ( ) : void setUp this method is used for setting up relations and attributes it should be implemented by child classes
state ( integer | string $state = null ) : null | integer assigns the state of this record or returns it if called without parameters
synchronizeWithArray ( array $array, boolean $deep = true ) synchronizes a Doctrine_Record instance and its relations with data from an array
toArray ( boolean $deep = true, boolean $prefixKey = false ) : array returns the record representation as an array
toString ( ) : string __toString alias
trySave ( Doctrine_Connection $conn = null ) : TRUE tries to save the object and all its related components.
unlink ( string $alias, array $ids = [], boolean $now = false ) : Doctrine_Record unlink removes links from this record to given records if no ids are given, it removes all links
unlinkInDb ( string $alias, array $ids = [] ) : Doctrine_Record unlink now the related components, querying the db
unserialize ( string $serialized ) : void this method is automatically called everytime an instance is unserialized
unshiftFilter ( Doctrine_Record_Filter $filter )

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

Метод Описание
_get ( $fieldName, $load = true )
_isValueModified ( string $type, string $old, string $new ) : boolean Check if a value has changed according to Doctrine Doctrine is loose with type checking in the same ways PHP is for consistancy of behavior
_resetModified ( ) : void Reset the modified array and store the old array in lastModified so it can be accessed by users after saving a record, since the modified array is reset after the object is saved.
_set ( $fieldName, $value, $load = true )
validate ( ) Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure, doing any custom / specialized validations that are neccessary.
validateOnInsert ( ) Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure only when the record is going to be inserted into the data store the first time.
validateOnUpdate ( ) Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure only when the record is going to be updated.

Приватные методы

Метод Описание
prepareIdentifiers ( boolean $exists = true ) : void prepareIdentifiers prepares identifiers for later use

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

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

the function of this method is to try to find a given method from the templates (behaviors) the record is using, and if found, execute it. Note that already existing methods would not be overloaded. So, in sense, this method replicates the usage of mixins (as seen in some programming languages)
public __call ( string $method, array $args ) : mixed
$method string name of the method
$args array method arguments
Результат mixed the return value of the given method

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

constructor
public __construct ( Doctrine_Table | null $table = null, boolean $isNewEntry = false )
$table Doctrine_Table | null a Doctrine_Table object or null, if null the table object is retrieved from current connection
$isNewEntry boolean whether or not this record is transient

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

magic method
public __toString ( ) : string
Результат string representation of this object

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

deletes a column or a related component.
public __unset ( string $name ) : void
$name string
Результат void

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

protected _get ( $fieldName, $load = true )

_index() публичный статический Метод

the current instance counter used to generate unique ids for php objects. Contains the next identifier.
public static _index ( ) : integer
Результат integer

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

This function basically says if what is being set is of Doctrine type boolean and something like current_value == 1 && new_value = true would not be considered modified Simply doing $old !== $new will return false for boolean columns would mark the field as modified and change it in the database when it is not necessary
protected _isValueModified ( string $type, string $old, string $new ) : boolean
$type string Doctrine type of the column
$old string Old value
$new string New value
Результат boolean $modified Whether or not Doctrine considers the value modified

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

Reset the modified array and store the old array in lastModified so it can be accessed by users after saving a record, since the modified array is reset after the object is saved.
protected _resetModified ( ) : void
Результат void

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

protected _set ( $fieldName, $value, $load = true )

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

setDefaultValues sets the default values for records internal data
public assignDefaultValues ( boolean $overwrite = false ) : boolean
$overwrite boolean whether or not to overwrite the already set values
Результат boolean

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

assigns an identifier to the instance, for database storage
public assignIdentifier ( mixed $id = false ) : void
$id mixed a key value or an array of keys
Результат void

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

Assign the inheritance column values
public assignInheritanceValues ( ) : void
Результат void

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

call
public call ( string | array $callback, string $column ) : Doctrine_Record
$callback string | array valid callback
$column string column name
Результат Doctrine_Record provides a fluent interface

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

cleanData leaves the $data array only with values whose key is a field inside this record and returns the values that were removed from $data. Also converts any values of 'null' to objects of type Doctrine_Null.
public cleanData ( array &$data ) : array
$data array data array to be cleaned
Результат array values cleaned from data

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

clears the accessor for a field name
public clearAccessor ( string $fieldName ) : void
$fieldName string
Результат void

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

makes all the already used save hooks available again

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

clears the custom mutator for a field name
public clearMutator ( string $fieldName ) : void
$fieldName string
Результат void

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

Clear a related reference or all references
public clearRelated ( string $name = null ) : void
$name string The relationship reference to clear
Результат void

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

alias for @see count()
public columnCount ( ) : integer
Результат integer the number of columns in this record

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

construct Empty template method to provide concrete Record classes with the possibility to hook into the constructor procedure
public construct ( ) : void
Результат void

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

test whether a field (column, mapped value, related component) is accessible by @see get()
public contains ( string $fieldName ) : boolean
$fieldName string
Результат boolean

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

generates a copy of this object. Returns an instance of the same class of $this.
public copy ( boolean $deep = false ) : Doctrine_Record
$deep boolean whether to duplicates the objects targeted by the relations
Результат Doctrine_Record

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

This method inserts a related component instance in this record relations, populating the foreign keys accordingly.
public coreSetRelated ( string $name, Doctrine_Record | Doctrine_Collection $value )
$name string related component alias in the relation
$value Doctrine_Record | Doctrine_Collection object to be linked as a related component

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

implements Countable interface
public count ( ) : integer
Результат integer the number of columns in this record

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

this event can be listened by the onPreDelete and onDelete listeners
public delete ( Doctrine_Connection $conn = null ) : boolean
$conn Doctrine_Connection
Результат boolean true if successful

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

used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
public deleteNode ( )

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

assigns the ErrorStack or returns it if called without parameters
public errorStack ( $stack = null ) : void | Doctrine_Validator_ErrorStack
Результат void | Doctrine_Validator_ErrorStack returns the errorStack associated with this record

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

returns true if this record is saved in the database, otherwise false (it is transient)
public exists ( ) : boolean
Результат boolean

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

exports instance to a chosen format
public exportTo ( string $type, string $deep = true ) : string
$type string format type: array, xml, yml, json
$deep string whether or not to export all relationships
Результат string representation as $type format. Array is $type is array

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

Cuts all references the entity has to other entities and removes the entity from the instance pool. Note: The entity is no longer useable after free() has been called. Any operations done with the entity afterwards can lead to unpredictable results.
public free ( boolean $deep = false )
$deep boolean whether to free also the related components

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

imports data from a php array
public fromArray ( array $array, boolean $deep = true ) : void
$array array array of data, see link for documentation
$deep boolean whether or not to act on relations
Результат void

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

returns a value of a property or a related component
public get ( mixed $fieldName, boolean $load = true ) : mixed
$fieldName mixed name of the property or related component
$load boolean whether or not to invoke the loading procedure
Результат mixed

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

gets the custom accessor for a field name
public getAccessor ( string $fieldName ) : string
$fieldName string
Результат string $accessor

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

gets all accessors for this component instance
public getAccessors ( ) : array
Результат array $accessors

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

return all the internal data (columns)
public getData ( ) : array
Результат array an array containing all the properties

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

retrieves the ErrorStack. To be called after a failed validation attempt (@see isValid()).
public getErrorStack ( ) : Doctrine_Validator_ErrorStack
Результат Doctrine_Validator_ErrorStack returns the errorStack associated with this record

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

Useful for outputting errors to user via web browser
public getErrorStackAsString ( ) : string
Результат string $message

getIncremented() закрытый публичный Метод

returns the value of autoincremented primary key of this object (if any)
final public getIncremented ( ) : integer
Результат integer

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

implements IteratorAggregate interface
public getIterator ( ) : Doctrine_Record_Iterator
Результат Doctrine_Record_Iterator iterator through data

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

getLast this method is used internally by Doctrine_Query it is needed to provide compatibility between records and collections
public getLast ( ) : Doctrine_Record
Результат Doctrine_Record

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

returns an array of the modified fields from the last transaction.
public getLastModified ( boolean $old = false ) : array
$old boolean pick the old values (instead of the new ones)
Результат array

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

retrieves an array of modified fields and associated new values.
public getModified ( boolean $old = false, boolean $last = false ) : array
$old boolean pick the old values (instead of the new ones)
$last boolean pick only lastModified values (@see getLastModified())
Результат array $a

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

gets the custom mutator for a field name
public getMutator ( $fieldName ) : string
Результат string

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

gets all custom mutators for this component instance
public getMutators ( ) : array
Результат array $mutators

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

getter for node associated with this record
public getNode ( ) : Doctrine_Node
Результат Doctrine_Node false if component is not a Tree

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

public getOid ( ) : integer
Результат integer the object identifier

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

returns Doctrine_Record instances which need to be deleted on save
public getPendingDeletes ( ) : array
Результат array

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

Returns an array of modified fields and values with data preparation; adds column aggregation inheritance and converts Records into primary key values.
public getPrepared ( array $array = [] ) : array
$array array
Результат array

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

get all related components
public getReferences ( ) : array
Результат array various Doctrine_Collection or Doctrine_Record instances

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

returns the table object for this record.
public getTable ( ) : Doctrine_Table
Результат Doctrine_Table a Doctrine_Table object

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

sets a fieldname to have a custom accessor or check if a field has a custom accessor defined (when called without $accessor parameter).
public hasAccessor ( string $fieldName, string $accessor = null ) : boolean
$fieldName string
$accessor string
Результат boolean

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

Set a fieldname to have a custom accessor and mutator
public hasAccessorMutator ( $fieldName, string $accessor, string $mutator )
$accessor string
$mutator string

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

Tests whether a mapped value exists
public hasMappedValue ( string $name ) : boolean
$name string the name of the property
Результат boolean

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

sets a fieldname to have a custom mutator or check if a field has a custom mutator defined (when called without the $mutator parameter)
public hasMutator ( string $fieldName, string $mutator = null ) : boolean
$fieldName string
$mutator string
Результат boolean

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

tests whether a relation is set
public hasReference ( string $name ) : boolean
$name string relation alias
Результат boolean

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

checks existence of properties and related components
public hasRelation ( mixed $fieldName ) : boolean
$fieldName mixed name of the property or reference
Результат boolean

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

hydrate hydrates this object from given array
public hydrate ( array $data, boolean $overwriteLocalChanges = true ) : void
$data array
$overwriteLocalChanges boolean whether to overwrite the unsaved (dirty) data
Результат void

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

returns the primary keys of this object
public identifier ( ) : array
Результат array

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

imports data from a chosen format in the current instance
public importFrom ( string $type, string $data, $deep = true ) : void
$type string Format type: xml, yml, json
$data string Data to be parsed and imported
Результат void

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

$this->invokeSaveHooks('pre', 'save');
public invokeSaveHooks ( string $when, string $type, Doctrine_Event $event = null ) : Doctrine_Event
$when string 'post' or 'pre'
$type string serialize, unserialize, save, delete, update, insert, validate, dqlSelect, dqlDelete, hydrate
$event Doctrine_Event event raised
Результат Doctrine_Event the event generated using the type, if not specified

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

indicates whether record has any not loaded fields
public isInProxyState ( ) : boolean
Результат boolean

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

returns true if this record was modified, otherwise false
public isModified ( boolean $deep = false ) : boolean
$deep boolean whether to process also the relations for changes
Результат boolean

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

tests validity of the record using the current data.
public isValid ( boolean $deep = false, boolean $hooks = true ) : boolean
$deep boolean run the validation process on the relations
$hooks boolean invoke save hooks before start
Результат boolean whether or not this record is valid

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

creates links from this record to given records now, querying the db
public linkInDb ( string $alias, array $ids ) : Doctrine_Record
$alias string related component alias
$ids array the identifiers of the related records
Результат Doctrine_Record this object (fluent interface)

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

Used to move a record from PROXY to CLEAN/DIRTY state.
public load ( array $data = [] ) : boolean
$data array overwriting data to load in the record. Instance is hydrated from the table if not specified.
Результат boolean

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

loadReference loads a related component
public loadReference ( string $name ) : void
$name string alias of the relation
Результат void

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

Normally used by Doctrine for the mapping of aggregate values.
public mapValue ( string $name, mixed $value = null ) : void
$name string the name of the mapped value
$value mixed mixed value to be mapped
Результат void

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

merges this record with an array of values or with another existing instance of this object
public merge ( $data, boolean $deep = true ) : void
$deep boolean whether or not to merge relations
Результат void

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

gets a related component and fails if it does not exist
public obtainReference ( string $name )
$name string

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

public oid ( )

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

Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.
public postDelete ( $event )

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

Empty template method to provide Record classes with the ability to alter hydration after it runs
public postHydrate ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be inserted into the data store the first time.
public postInsert ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure.
public postSave ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
public postSerialize ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
public postUnserialize ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be updated.
public postUpdate ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure.
public postValidate ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.
public preDelete ( $event )

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

Empty template method to provide Record classes with the ability to alter DQL delete queries at runtime
public preDqlDelete ( $event )

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

Empty template method to provide Record classes with the ability to alter DQL select queries at runtime
public preDqlSelect ( $event )

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

Empty template method to provide Record classes with the ability to alter DQL update queries at runtime
public preDqlUpdate ( $event )

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

Empty template method to provide Record classes with the ability to alter hydration before it runs
public preHydrate ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be inserted into the data store the first time.
public preInsert ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure.
public preSave ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
public preSerialize ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the serializing procedure.
public preUnserialize ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the saving procedure only when the record is going to be updated.
public preUpdate ( $event )

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

Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure. Useful for cleaning up data before validating it.
public preValidate ( $event )

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

returns the value of a property (column). If the property is not yet loaded this method does NOT load it.
public rawGet ( $fieldName ) : mixed
Результат mixed

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

gets a related component
public reference ( string $name ) : Doctrine_Record | Doctrine_Collection
$name string
Результат Doctrine_Record | Doctrine_Collection

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

refresh refresh internal data from the database
public refresh ( boolean $deep = false ) : boolean
$deep boolean If true, fetch also current relations. Caution: this deletes any aggregated values you may have queried beforee
Результат boolean

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

refresh refresh data of related objects from the database
public refreshRelated ( string $name = null ) : Doctrine_Record
$name string name of a related component. if set, this method only refreshes the specified related component
Результат Doctrine_Record this object

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

Check if a related relationship exists. Will lazily load the relationship in order to check. If the reference didn't already exist and it doesn't exist in the database, the related reference will be cleared immediately.
public relatedExists ( string $name ) : boolean
$name string
Результат boolean Whether or not the related relationship exists

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

The REPLACE type of query does not make part of the SQL standards. Since practically only MySQL and SQLIte implement it natively, this type of query isemulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.
public replace ( Doctrine_Connection $conn = null ) : integer
$conn Doctrine_Connection optional connection parameter
Результат integer number of rows affected

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

this method also saves the related components
public save ( Doctrine_Connection $conn = null ) : void
$conn Doctrine_Connection optional connection parameter
Результат void

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

serialize this method is automatically called when an instance of Doctrine_Record is serialized
public serialize ( ) : string
Результат string

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

This is used by caching since we want to serialize references when caching but not when just normally serializing a instance
public serializeReferences ( boolean $bool = null ) : boolean
$bool boolean
Результат boolean $bool

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

alters mapped values, properties and related components.
public set ( $fieldName, mixed $value, boolean $load = true ) : Doctrine_Record
$value mixed value of the property or reference
$load boolean whether or not to refresh / load the uninitialized record data
Результат Doctrine_Record

setRelated() закрытый публичный Метод

set a related component
final public setRelated ( string $alias, Doctrine_Access $coll )
$alias string
$coll Doctrine_Access

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

setUp this method is used for setting up relations and attributes it should be implemented by child classes
public setUp ( ) : void
Результат void

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

assigns the state of this record or returns it if called without parameters
public state ( integer | string $state = null ) : null | integer
$state integer | string if set, this method tries to set the record state to $state
Результат null | integer

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

it expects an array representation of a Doctrine_Record similar to the return value of the toArray() method. If the array contains relations it will create those that don't exist, update the ones that do, and delete the ones missing on the array but available on the Doctrine_Record (unlike @see fromArray() that does not touch what it is not in $array)
public synchronizeWithArray ( array $array, boolean $deep = true )
$array array representation of a Doctrine_Record
$deep boolean whether or not to act on relations

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

returns the record representation as an array
public toArray ( boolean $deep = true, boolean $prefixKey = false ) : array
$deep boolean whether to include relations
$prefixKey boolean not used
Результат array

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

__toString alias
public toString ( ) : string
Результат string

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

In contrast to Doctrine_Record::save(), this method does not throw an exception when validation fails but returns TRUE on success or FALSE on failure.
public trySave ( Doctrine_Connection $conn = null ) : TRUE
$conn Doctrine_Connection optional connection parameter
Результат TRUE if the record was saved sucessfully without errors, FALSE otherwise.

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

unlink now the related components, querying the db
public unlinkInDb ( string $alias, array $ids = [] ) : Doctrine_Record
$alias string related component alias
$ids array the identifiers of the related records
Результат Doctrine_Record this object (fluent interface)

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

this method is automatically called everytime an instance is unserialized
public unserialize ( string $serialized ) : void
$serialized string Doctrine_Record as serialized string
Результат void

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

public unshiftFilter ( Doctrine_Record_Filter $filter )
$filter Doctrine_Record_Filter

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

Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure, doing any custom / specialized validations that are neccessary.
protected validate ( )

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

Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure only when the record is going to be inserted into the data store the first time.
protected validateOnInsert ( )

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

Empty template method to provide concrete Record classes with the possibility to hook into the validation procedure only when the record is going to be updated.
protected validateOnUpdate ( )

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

$_customAccessors защищенное статическое свойство

Array of custom accessors for cache
protected static array $_customAccessors
Результат array

$_customMutators защищенное статическое свойство

Array of custom mutators for cache
protected static array $_customMutators
Результат array

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

each element is one of 3 following types: - simple type (int, string) - field has a scalar value - null - field has NULL value in DB - Doctrine_Null - field value is unknown, it wasn't loaded yet
protected array $_data
Результат array

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

error stack object
protected $_errorStack

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

the primary keys of this object
protected int $_id
Результат integer

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

Array containing the save hooks and events that have been invoked
protected array $_invokedSaveHooks
Результат array

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

an array containing field names that were modified in the previous transaction
protected array $_lastModified
Результат array

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

an array containing field names that have been modified
protected array $_modified
Результат array

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

protected $_node

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

an array of the old values from set properties
protected array $_oldValues
Результат array

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

Doctrine_Collection of objects needing to be deleted on save
protected string $_pendingDeletes
Результат string

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

an array containing all the references
protected array $_references
Результат array

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

Whether or not to serialize references when a Doctrine_Record is serialized
protected bool $_serializeReferences
Результат boolean

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

the state of this record
protected int $_state
Результат integer

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

the values array, aggregate values and such are mapped into this array
protected array $_values
Результат array