You are currently viewing the 0.10 branch api documentation. Switch to 1.0 or 1.1

0.10 Doctrine_Record

Doctrine Record

Doctrine_Record All record classes should inherit this super class

Inheritence

Doctrine_Record  < Doctrine_Record_Abstract  < Doctrine_Access

Direct Sub-Classes

Method Summary

Returns Name Description
boolean assignDefaultValues
assignIdentifier
call
array cleanData
clearRelated (references to related objects still remain on Table objects)
integer columnCount
construct
boolean contains
copy
coreSetRelated
integer count
boolean delete this event can be listened by the onPreDelete and onDelete listeners
deleteNode
errorStack
boolean exists
exportTo
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.
fromArray Import data from a php array
mixed get
array getData
getErrorStack
integer getIncremented
getIterator
getLast this method is used internally be Doctrine_Query it is needed to provide compatibility between records and collections
array getModified
mixed getNode
integer getOid
array getPendingDeletes
array getPrepared returns an array of modified fields and values with data preparation adds column aggregation inheritance and converts Records into primary key values
array getReferences
getTable
boolean hasReference
boolean hasRelation
boolean hydrate
array identifier
importFrom Import data from an external data source
boolean isModified
boolean isValid
link
boolean load
loadReference
mapValue Usually this method is used internally by Doctrine for the mapping of aggregate values.
merge merges this record with an array of values or with another existing instance of this object
modifiedFields
obtainReference
oid
postDelete
postInsert
postSave
postSerialize
postUnserialize
postUpdate
preDelete
preInsert
preSave
preSerialize
preUnserialize
preUpdate
mixed rawGet
reference
boolean refresh
refreshRelated
integer replace Execute 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. The REPLACE type o
revert
save this method also saves the related components
array serialize
set
setRelated
setUp
state
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 b
array toArray
toString
TRUE 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.
unlink
unserialize
unshiftFilter
validate
validateOnInsert
validateOnUpdate
integer _index
mixed __call the function of this method is to try to find given method from the templates this record is using and if it finds given method it will execute it So, in sense, this method replicates the usage of mixins (as seen in some programming languages)
__construct
__toString
__unset

Method Details

  • $overwrite whether or not to overwrite the already set values

    (boolean) assignDefaultValues($overwrite = false)

    setDefaultValues sets the default values for records internal data


  • assignIdentifier($id = false)


  • $callback valid callback
    $column column name
    2 arg1 ... argN optional callback arguments

    call((string|array) $callback, $column, 2)


  • $data data array to be cleaned

    (array) cleanData([[[amp]]]$data, $data)

    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.

    Doctrine_Record


  • clearRelated()

    clearRelated unsets all the relationships this object has

    (references to related objects still remain on Table objects)


  • (integer) columnCount()

    alias for count()

    Doctrine_Record


  • construct()

    construct Empty template method to provide concrete Record classes with the possibility to hook into the constructor procedure


  • (boolean) contains($fieldName, $name)


  • copy($deep = false)

    copy returns a copy of this object


  • coreSetRelated($name, $value)

    DESCRIBE WHAT THIS METHOD DOES, PLEASE!


  • (integer) count()

    count this class implements countable interface

    Doctrine_Record


  • (boolean) delete(( ) $conn = null)

    deletes this data access object and all the related composites this operation is isolated by a transaction

    this event can be listened by the onPreDelete and onDelete listeners

    Doctrine_Record


  • deleteNode()

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


  • $stack errorStack to be assigned for this record

    errorStack((Doctrine_Validator_ErrorStack) $stack = null)

    errorStack assigns / returns record errorStack

    Doctrine_Record


  • (boolean) exists()

    exists returns true if this record is persistent, otherwise false


  • $type Format type: xml, yml, json
    $deep Whether or not to export deep in to all relationships

    exportTo($type, $deep = true)


  • free($deep = false)

    Helps freeing the memory occupied by the entity.

    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.


  • $array Php array of data
    $deep Bool value for whether or not to merge the data deep

    fromArray($array, $deep = true)

    Import data from a php array


  • $load whether or not to invoke the loading procedure
    $name name of the property or related component

    (mixed) get($fieldName, $load = true, $name)

    get returns a value of a property or a related component

    throws Doctrine_Record_Exception if trying to get a value of unknown property / related component


  • (array) getData()

    getData return all the internal data

    Doctrine_Record


  • getErrorStack()

    Doctrine_Record


  • (integer) getIncremented()

    returns the value of autoincremented primary key of this object (if any)


  • getIterator()

    Doctrine_Record


  • getLast()

    this method is used internally be Doctrine_Query it is needed to provide compatibility between records and collections


  • (array) getModified()

    returns an array of modified fields and associated values


  • (mixed) getNode()

    getter for node assciated with this record

    Doctrine_Record


  • (integer) getOid()

    getOid returns the object identifier


  • (array) getPendingDeletes()

    Doctrine_Record


  • (array) getPrepared($array = array())

    returns an array of modified fields and values with data preparation adds column aggregation inheritance and converts Records into primary key values


  • (array) getReferences()

    Doctrine_Record


  • getTable()

    getTable returns the table object for this record

    Doctrine_Record


  • (boolean) hasReference($name)

    hasRefence


  • $name name of the property or reference

    (boolean) hasRelation($fieldName, $name)

    method for checking existence of properties and Doctrine_Record references


  • (boolean) hydrate($data)

    hydrate hydrates this object from given array


  • (array) identifier()

    returns the primary keys of this object


  • $type Format type: xml, yml, json
    $data Data to be parsed and imported

    importFrom($type, $data)

    Import data from an external data source


  • (boolean) isModified()

    isModified returns true if this record was modified, otherwise false


  • (boolean) isValid()

    Doctrine_Record


  • $alias related component alias
    $ids the identifiers of the related records

    link($alias, $ids)

    link creates links from this record to given records

    Doctrine_Record


  • (boolean) load()

    load loads all the uninitialized properties from the database


  • loadReference($name)

    loadReference loads a related component

    throws Doctrine_Table_Exception if trying to load an unknown related component


  • $name the name of the mapped value
    $value mixed value to be mapped

    mapValue($name, $value)

    mapValue This simple method is used for mapping values to $values property.

    Usually this method is used internally by Doctrine for the mapping of aggregate values.


  • $data Data to merge. Either another instance of this model or an array
    $deep Bool value for whether or not to merge the data deep

    merge($data, $deep = true)

    merges this record with an array of values or with another existing instance of this object


  • modifiedFields()

    REDUNDANT?


  • obtainReference($name)

    throws Doctrine_Record_Exception if trying to get an unknown related component


  • oid()


  • postDelete($event)

    Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.


  • 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.


  • preDelete($event)

    Empty template method to provide concrete Record classes with the possibility to hook into the deletion procedure.


  • 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.


  • $fieldName name of the property

    (mixed) rawGet(($name) $fieldName)

    rawGet returns the value of a property, if the property is not yet loaded this method does NOT load it

    throws Doctrine_Record_Exception if trying to get an unknown property


  • reference($name)


  • $deep If true, fetch also current relations. Caution: this deletes any aggregated values you may have queried beforee

    (boolean) refresh($deep = false)

    refresh refresh internal data from the database

    throws Doctrine_Record_Exception When the refresh operation fails (when the database row this record represents does not exist anymore)


  • $name name of a related component. if set, this method only refreshes the specified related component

    refreshRelated($name = null)

    refresh refres data of related objects from the database

    Doctrine_Record


  • $conn optional connection parameter

    (integer) replace(( ) $conn = null)

    Execute 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.
    The REPLACE type o

    Doctrine_Record

    throws Doctrine_Connection_Exception if some of the key values was null


  • $version an integer > 1

    revert($version)

    revert reverts this record to given version, this method only works if versioning plugin is enabled

    Doctrine_Record

    throws Doctrine_Record_Exception if given version does not exist


  • $conn optional connection parameter

    save(( ) $conn = null)

    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

    this method also saves the related components


  • (array) serialize()

    serialize this method is automatically called when this Doctrine_Record is serialized


  • $value value of the property or reference
    $load whether or not to refresh / load the uninitialized record data
    $name name of the property or reference

    set($fieldName, $value, $load = true, $name)

    set method for altering properties and Doctrine_Record references if the load parameter is set to false this method will not try to load uninitialized record data

    throws Doctrine_Record_Exception if trying to set a value of wrong type for related component


  • setRelated($alias, ( ) $coll)


  • setUp()

    setUp this method is used for setting up relations and attributes it should be implemented by child classes


  • $state if set, this method tries to set the record state to $state

    state((integer|string) $state = null)

    state returns / assigns the state of this record

    throws Doctrine_Record_State_Exception if trying to set an unknown state


  • $array representation of a Doctrine_Record

    synchronizeWithArray($array)

    synchronizeWithArray synchronizes a Doctrine_Record and its relations with data from an array

    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 b


  • $deep - Return also the relations

    (array) toArray($deep = true, $prefixKey = false)

    toArray returns the record as an array


  • toString()


  • $conn optional connection parameter

    (TRUE) trySave(( ) $conn = null)

    Tries to save the object and all its related components.

    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.

    Doctrine_Record


  • $alias related component alias
    $ids the identifiers of the related records

    unlink($alias, $ids = array())

    unlink removes links from this record to given records if no ids are given, it removes all links

    Doctrine_Record


  • $serialized Doctrine_Record as serialized string

    unserialize($serialized)

    unseralize this method is automatically called everytime a Doctrine_Record object is unserialized

    throws Doctrine_Record_Exception if the cleanData operation fails somehow


  • unshiftFilter(( ) $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.


  • 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.


  • (integer) _index()


  • $method name of the method
    $args method arguments

    (mixed) __call($method, $args)

    __call this method is a magic method that is being used for method overloading

    the function of this method is to try to find given method from the templates this record is using and if it finds given method it will execute it
    So, in sense, this method replicates the usage of mixins (as seen in some programming languages)

    Doctrine_Record


  • $table a Doctrine_Table object or null, if null the table object is retrieved from current connection
    $isNewEntry whether or not this record is transient

    __construct((Doctrine_Table|null) $table = null, $isNewEntry = false)

    constructor

    throws Doctrine_Record_Exception if the cleanData operation fails somehow


  • __toString()

    returns a string representation of this object


  • __unset($name)