PHP Class Doctrine_Record, ZFPlanet

Since: 1.0
Author: Konsta Vesterinen ([email protected])
Inheritance: extends Doctrine_Record_Abstract, implements Countable, implements IteratorAggregate, implements Serializable
显示文件 Open project: padraic/ZFPlanet Class Usage Examples

Protected Properties

Property Type Description
$_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

Public Methods

Method Description
__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 )

Protected Methods

Method Description
_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.

Private Methods

Method Description
prepareIdentifiers ( boolean $exists = true ) : void prepareIdentifiers prepares identifiers for later use

Method Details

__call() public method

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
return mixed the return value of the given method

__construct() public method

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() public method

magic method
public __toString ( ) : string
return string representation of this object

__unset() public method

deletes a column or a related component.
public __unset ( string $name ) : void
$name string
return void

_get() protected method

protected _get ( $fieldName, $load = true )

_index() public static method

the current instance counter used to generate unique ids for php objects. Contains the next identifier.
public static _index ( ) : integer
return integer

_isValueModified() protected method

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
return boolean $modified Whether or not Doctrine considers the value modified

_resetModified() protected method

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
return void

_set() protected method

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

assignDefaultValues() public method

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
return boolean

assignIdentifier() public method

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
return void

assignInheritanceValues() public method

Assign the inheritance column values
public assignInheritanceValues ( ) : void
return void

call() public method

call
public call ( string | array $callback, string $column ) : Doctrine_Record
$callback string | array valid callback
$column string column name
return Doctrine_Record provides a fluent interface

cleanData() public method

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
return array values cleaned from data

clearAccessor() public method

clears the accessor for a field name
public clearAccessor ( string $fieldName ) : void
$fieldName string
return void

clearInvokedSaveHooks() public method

makes all the already used save hooks available again

clearMutator() public method

clears the custom mutator for a field name
public clearMutator ( string $fieldName ) : void
$fieldName string
return void

clearRelated() public method

Clear a related reference or all references
public clearRelated ( string $name = null ) : void
$name string The relationship reference to clear
return void

columnCount() public method

alias for @see count()
public columnCount ( ) : integer
return integer the number of columns in this record

construct() public method

construct Empty template method to provide concrete Record classes with the possibility to hook into the constructor procedure
public construct ( ) : void
return void

contains() public method

test whether a field (column, mapped value, related component) is accessible by @see get()
public contains ( string $fieldName ) : boolean
$fieldName string
return boolean

copy() public method

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
return Doctrine_Record

coreSetRelated() public method

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() public method

implements Countable interface
public count ( ) : integer
return integer the number of columns in this record

delete() public method

this event can be listened by the onPreDelete and onDelete listeners
public delete ( Doctrine_Connection $conn = null ) : boolean
$conn Doctrine_Connection
return boolean true if successful

deleteNode() public method

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

errorStack() public method

assigns the ErrorStack or returns it if called without parameters
public errorStack ( $stack = null ) : void | Doctrine_Validator_ErrorStack
return void | Doctrine_Validator_ErrorStack returns the errorStack associated with this record

exists() public method

returns true if this record is saved in the database, otherwise false (it is transient)
public exists ( ) : boolean
return boolean

exportTo() public method

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
return string representation as $type format. Array is $type is array

free() public method

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() public method

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
return void

get() public method

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
return mixed

getAccessor() public method

gets the custom accessor for a field name
public getAccessor ( string $fieldName ) : string
$fieldName string
return string $accessor

getAccessors() public method

gets all accessors for this component instance
public getAccessors ( ) : array
return array $accessors

getData() public method

return all the internal data (columns)
public getData ( ) : array
return array an array containing all the properties

getErrorStack() public method

retrieves the ErrorStack. To be called after a failed validation attempt (@see isValid()).
public getErrorStack ( ) : Doctrine_Validator_ErrorStack
return Doctrine_Validator_ErrorStack returns the errorStack associated with this record

getErrorStackAsString() public method

Useful for outputting errors to user via web browser
public getErrorStackAsString ( ) : string
return string $message

getIncremented() final public method

returns the value of autoincremented primary key of this object (if any)
final public getIncremented ( ) : integer
return integer

getIterator() public method

implements IteratorAggregate interface
public getIterator ( ) : Doctrine_Record_Iterator
return Doctrine_Record_Iterator iterator through data

getLast() public method

getLast this method is used internally by Doctrine_Query it is needed to provide compatibility between records and collections
public getLast ( ) : Doctrine_Record
return Doctrine_Record

getLastModified() public method

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)
return array

getModified() public method

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())
return array $a

getMutator() public method

gets the custom mutator for a field name
public getMutator ( $fieldName ) : string
return string

getMutators() public method

gets all custom mutators for this component instance
public getMutators ( ) : array
return array $mutators

getNode() public method

getter for node associated with this record
public getNode ( ) : Doctrine_Node
return Doctrine_Node false if component is not a Tree

getOid() public method

public getOid ( ) : integer
return integer the object identifier

getPendingDeletes() public method

returns Doctrine_Record instances which need to be deleted on save
public getPendingDeletes ( ) : array
return array

getPrepared() public method

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
return array

getReferences() public method

get all related components
public getReferences ( ) : array
return array various Doctrine_Collection or Doctrine_Record instances

getTable() public method

returns the table object for this record.
public getTable ( ) : Doctrine_Table
return Doctrine_Table a Doctrine_Table object

hasAccessor() public method

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
return boolean

hasAccessorMutator() public method

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

hasMappedValue() public method

Tests whether a mapped value exists
public hasMappedValue ( string $name ) : boolean
$name string the name of the property
return boolean

hasMutator() public method

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
return boolean

hasReference() public method

tests whether a relation is set
public hasReference ( string $name ) : boolean
$name string relation alias
return boolean

hasRelation() public method

checks existence of properties and related components
public hasRelation ( mixed $fieldName ) : boolean
$fieldName mixed name of the property or reference
return boolean

hydrate() public method

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
return void

identifier() public method

returns the primary keys of this object
public identifier ( ) : array
return array

importFrom() public method

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
return void

invokeSaveHooks() public method

$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
return Doctrine_Event the event generated using the type, if not specified

isInProxyState() public method

indicates whether record has any not loaded fields
public isInProxyState ( ) : boolean
return boolean

isModified() public method

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
return boolean

isValid() public method

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
return boolean whether or not this record is valid

linkInDb() public method

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
return Doctrine_Record this object (fluent interface)

load() public method

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.
return boolean

loadReference() public method

loadReference loads a related component
public loadReference ( string $name ) : void
$name string alias of the relation
return void

mapValue() public method

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
return void

merge() public method

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
return void

obtainReference() public method

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

oid() public method

public oid ( )

postDelete() public method

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

postHydrate() public method

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

postInsert() public method

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() public method

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

postSerialize() public method

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

postUnserialize() public method

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

postUpdate() public method

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() public method

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

preDelete() public method

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

preDqlDelete() public method

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

preDqlSelect() public method

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

preDqlUpdate() public method

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

preHydrate() public method

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

preInsert() public method

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() public method

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

preSerialize() public method

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

preUnserialize() public method

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

preUpdate() public method

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() public method

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() public method

returns the value of a property (column). If the property is not yet loaded this method does NOT load it.
public rawGet ( $fieldName ) : mixed
return mixed

reference() public method

gets a related component
public reference ( string $name ) : Doctrine_Record | Doctrine_Collection
$name string
return Doctrine_Record | Doctrine_Collection

refresh() public method

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
return boolean

refreshRelated() public method

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
return Doctrine_Record this object

relatedExists() public method

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
return boolean Whether or not the related relationship exists

replace() public method

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
return integer number of rows affected

save() public method

this method also saves the related components
public save ( Doctrine_Connection $conn = null ) : void
$conn Doctrine_Connection optional connection parameter
return void

serialize() public method

serialize this method is automatically called when an instance of Doctrine_Record is serialized
public serialize ( ) : string
return string

serializeReferences() public method

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
return boolean $bool

set() public method

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
return Doctrine_Record

setRelated() final public method

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

setUp() public method

setUp this method is used for setting up relations and attributes it should be implemented by child classes
public setUp ( ) : void
return void

state() public method

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
return null | integer

synchronizeWithArray() public method

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() public method

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
return array

toString() public method

__toString alias
public toString ( ) : string
return string

trySave() public method

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
return TRUE if the record was saved sucessfully without errors, FALSE otherwise.

unlinkInDb() public method

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
return Doctrine_Record this object (fluent interface)

unserialize() public method

this method is automatically called everytime an instance is unserialized
public unserialize ( string $serialized ) : void
$serialized string Doctrine_Record as serialized string
return void

unshiftFilter() public method

public unshiftFilter ( Doctrine_Record_Filter $filter )
$filter Doctrine_Record_Filter

validate() protected method

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() protected method

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() protected method

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 ( )

Property Details

$_customAccessors protected_oe static_oe property

Array of custom accessors for cache
protected static array $_customAccessors
return array

$_customMutators protected_oe static_oe property

Array of custom mutators for cache
protected static array $_customMutators
return array

$_data protected_oe property

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
return array

$_errorStack protected_oe property

error stack object
protected $_errorStack

$_id protected_oe property

the primary keys of this object
protected int $_id
return integer

$_invokedSaveHooks protected_oe property

Array containing the save hooks and events that have been invoked
protected array $_invokedSaveHooks
return array

$_lastModified protected_oe property

an array containing field names that were modified in the previous transaction
protected array $_lastModified
return array

$_modified protected_oe property

an array containing field names that have been modified
protected array $_modified
return array

$_node protected_oe property

protected $_node

$_oldValues protected_oe property

an array of the old values from set properties
protected array $_oldValues
return array

$_pendingDeletes protected_oe property

Doctrine_Collection of objects needing to be deleted on save
protected string $_pendingDeletes
return string

$_references protected_oe property

an array containing all the references
protected array $_references
return array

$_serializeReferences protected_oe property

Whether or not to serialize references when a Doctrine_Record is serialized
protected bool $_serializeReferences
return boolean

$_state protected_oe property

the state of this record
protected int $_state
return integer

$_values protected_oe property

the values array, aggregate values and such are mapped into this array
protected array $_values
return array