PHP Class Doctrine_Record, ZFPlanet

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

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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 )

Méthodes protégées

Méthode 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

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

Method Details

__call() public méthode

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

__construct() public méthode

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 méthode

magic method
public __toString ( ) : string
Résultat string representation of this object

__unset() public méthode

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

_get() protected méthode

protected _get ( $fieldName, $load = true )

_index() public static méthode

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

_isValueModified() protected méthode

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

_resetModified() protected méthode

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
Résultat void

_set() protected méthode

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

assignDefaultValues() public méthode

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
Résultat boolean

assignIdentifier() public méthode

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
Résultat void

assignInheritanceValues() public méthode

Assign the inheritance column values
public assignInheritanceValues ( ) : void
Résultat void

call() public méthode

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

cleanData() public méthode

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
Résultat array values cleaned from data

clearAccessor() public méthode

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

clearInvokedSaveHooks() public méthode

makes all the already used save hooks available again

clearMutator() public méthode

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

clearRelated() public méthode

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

columnCount() public méthode

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

construct() public méthode

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

contains() public méthode

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

copy() public méthode

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
Résultat Doctrine_Record

coreSetRelated() public méthode

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 méthode

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

delete() public méthode

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

deleteNode() public méthode

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

errorStack() public méthode

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

exists() public méthode

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

exportTo() public méthode

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

free() public méthode

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 méthode

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
Résultat void

get() public méthode

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
Résultat mixed

getAccessor() public méthode

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

getAccessors() public méthode

gets all accessors for this component instance
public getAccessors ( ) : array
Résultat array $accessors

getData() public méthode

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

getErrorStack() public méthode

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

getErrorStackAsString() public méthode

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

getIncremented() final public méthode

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

getIterator() public méthode

implements IteratorAggregate interface
public getIterator ( ) : Doctrine_Record_Iterator
Résultat Doctrine_Record_Iterator iterator through data

getLast() public méthode

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

getLastModified() public méthode

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)
Résultat array

getModified() public méthode

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())
Résultat array $a

getMutator() public méthode

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

getMutators() public méthode

gets all custom mutators for this component instance
public getMutators ( ) : array
Résultat array $mutators

getNode() public méthode

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

getOid() public méthode

public getOid ( ) : integer
Résultat integer the object identifier

getPendingDeletes() public méthode

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

getPrepared() public méthode

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
Résultat array

getReferences() public méthode

get all related components
public getReferences ( ) : array
Résultat array various Doctrine_Collection or Doctrine_Record instances

getTable() public méthode

returns the table object for this record.
public getTable ( ) : Doctrine_Table
Résultat Doctrine_Table a Doctrine_Table object

hasAccessor() public méthode

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
Résultat boolean

hasAccessorMutator() public méthode

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

hasMappedValue() public méthode

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

hasMutator() public méthode

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
Résultat boolean

hasReference() public méthode

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

hasRelation() public méthode

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

hydrate() public méthode

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
Résultat void

identifier() public méthode

returns the primary keys of this object
public identifier ( ) : array
Résultat array

importFrom() public méthode

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
Résultat void

invokeSaveHooks() public méthode

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

isInProxyState() public méthode

indicates whether record has any not loaded fields
public isInProxyState ( ) : boolean
Résultat boolean

isModified() public méthode

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
Résultat boolean

isValid() public méthode

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

linkInDb() public méthode

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
Résultat Doctrine_Record this object (fluent interface)

load() public méthode

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.
Résultat boolean

loadReference() public méthode

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

mapValue() public méthode

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
Résultat void

merge() public méthode

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
Résultat void

obtainReference() public méthode

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

oid() public méthode

public oid ( )

postDelete() public méthode

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

postHydrate() public méthode

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

postInsert() public méthode

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 méthode

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

postSerialize() public méthode

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

postUnserialize() public méthode

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

postUpdate() public méthode

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 méthode

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

preDelete() public méthode

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

preDqlDelete() public méthode

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

preDqlSelect() public méthode

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

preDqlUpdate() public méthode

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

preHydrate() public méthode

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

preInsert() public méthode

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 méthode

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

preSerialize() public méthode

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

preUnserialize() public méthode

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

preUpdate() public méthode

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 méthode

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 méthode

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

reference() public méthode

gets a related component
public reference ( string $name ) : Doctrine_Record | Doctrine_Collection
$name string
Résultat Doctrine_Record | Doctrine_Collection

refresh() public méthode

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
Résultat boolean

refreshRelated() public méthode

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
Résultat Doctrine_Record this object

relatedExists() public méthode

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

replace() public méthode

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
Résultat integer number of rows affected

save() public méthode

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

serialize() public méthode

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

serializeReferences() public méthode

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
Résultat boolean $bool

set() public méthode

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
Résultat Doctrine_Record

setRelated() final public méthode

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

setUp() public méthode

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

state() public méthode

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
Résultat null | integer

synchronizeWithArray() public méthode

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 méthode

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
Résultat array

toString() public méthode

__toString alias
public toString ( ) : string
Résultat string

trySave() public méthode

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

unlinkInDb() public méthode

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
Résultat Doctrine_Record this object (fluent interface)

unserialize() public méthode

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

unshiftFilter() public méthode

public unshiftFilter ( Doctrine_Record_Filter $filter )
$filter Doctrine_Record_Filter

validate() protected méthode

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 méthode

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 méthode

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
Résultat array

$_customMutators protected_oe static_oe property

Array of custom mutators for cache
protected static array $_customMutators
Résultat 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
Résultat array

$_errorStack protected_oe property

error stack object
protected $_errorStack

$_id protected_oe property

the primary keys of this object
protected int $_id
Résultat integer

$_invokedSaveHooks protected_oe property

Array containing the save hooks and events that have been invoked
protected array $_invokedSaveHooks
Résultat array

$_lastModified protected_oe property

an array containing field names that were modified in the previous transaction
protected array $_lastModified
Résultat array

$_modified protected_oe property

an array containing field names that have been modified
protected array $_modified
Résultat array

$_node protected_oe property

protected $_node

$_oldValues protected_oe property

an array of the old values from set properties
protected array $_oldValues
Résultat array

$_pendingDeletes protected_oe property

Doctrine_Collection of objects needing to be deleted on save
protected string $_pendingDeletes
Résultat string

$_references protected_oe property

an array containing all the references
protected array $_references
Résultat array

$_serializeReferences protected_oe property

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

$_state protected_oe property

the state of this record
protected int $_state
Résultat integer

$_values protected_oe property

the values array, aggregate values and such are mapped into this array
protected array $_values
Résultat array