Doctrine


Doctrine\Doctrine_Record
/Doctrine/Record.php at line 34

Class Doctrine_Record

Class:Doctrine_Record - Superclass: Doctrine_Record_Abstract
Class:Doctrine_Record_Abstract - Superclass: Doctrine_Access
Class:Doctrine_Access - Superclass: Doctrine_Locator_Injectable
Doctrine_Locator_Injectable
⌊ Doctrine_Access
⌊ Doctrine_Record_Abstract
⌊ Doctrine_Record

public abstract class Doctrine_Record
extends Doctrine_Record_Abstract

Doctrine_Record All record classes should inherit this super class

Package:
Doctrine
Subpackage:
Record
Author:
Konsta Vesterinen
License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
1.0
Version:
$Revision: 7673 $
Category:
Locator

Field Summary
final int

STATE_CLEAN

CLEAN STATE a Doctrine_Record is in clean state when all of its properties are loaded from the database and none of its properties are changed.

final int

STATE_DIRTY

DIRTY STATE a Doctrine_Record is in dirty state when its properties are changed.

final int

STATE_LOCKED

LOCKED STATE a Doctrine_Record is temporarily locked during deletes and saves.

final int

STATE_PROXY

PROXY STATE a Doctrine_Record is in proxy state when its properties are not fully loaded.

final int

STATE_TCLEAN

NEW TCLEAN a Doctrine_Record is in transient clean state when it is created and none of its fields are modified.

final int

STATE_TDIRTY

TDIRTY STATE a Doctrine_Record is in transient dirty state when it is created and some of its fields are modified but it is NOT yet persisted into database.

final int

STATE_TLOCKED

TLOCKED STATE a Doctrine_Record is temporarily locked (and transient) during deletes and saves.

protected static array

$_customAccessors

Array of custom accessors for cache.

protected static array

$_customMutators

Array of custom mutators for cache.

protected array $_data the record data

$_data

each element is one of 3 following types: - simple type (int, string) - field has a scalar value - null - field has NULL value in DB - Doctrine_Null - field value is unknown, it wasn't loaded yet.

protected Doctrine_Validator_ErrorStack error stack object

$_errorStack

.

protected integer $_id the primary keys of this object

$_id

.

protected array

$_invokedSaveHooks

Array containing the save hooks and events that have been invoked.

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

$_lastModified

.

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

$_modified

.

protected Doctrine_Node_ node object

$_node

.

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

$_oldValues

.

protected string

$_pendingDeletes

Doctrine_Collection of objects needing to be deleted on save.

protected array $_pendingUnlinks

$_pendingUnlinks

Array of pending un links in format alias => keys to be executed after save.

protected array $_references an array containing all the references

$_references

.

protected boolean

$_serializeReferences

Whether or not to serialize references when a Doctrine_Record is serialized.

protected integer $_state the state of this record

$_state

.

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

$_values

.

Fields inherited from Doctrine\Doctrine_Record_Abstract
_table
Constructor Summary

Doctrine_Record(Doctrine_Table|null table, boolean isNewEntry)

constructor.

Method Summary
boolean

assignDefaultValues(boolean overwrite)

setDefaultValues sets the default values for records internal data.

void

assignIdentifier(mixed id)

assigns an identifier to the instance, for database storage.

void

assignInheritanceValues()

Assign the inheritance column values.

Doctrine_Record

call(string|array callback, string column, mixed arg1)

call.

array

cleanData(array 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.

void

clearAccessor(string fieldName)

clears the accessor for a field name.

void

clearInvokedSaveHooks()

makes all the already used save hooks available again.

void

clearMutator(string fieldName)

clears the custom mutator for a field name.

void

clearRelated(string name)

Clear a related reference or all references.

integer

columnCount()

alias for @see count().

void

construct()

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

boolean

contains(string fieldName, mixed offset)

test whether a field (column, mapped value, related component, accessor) is accessible by @see get().

Doctrine_Record

copy(boolean deep)

generates a copy of this object.

void

coreSetRelated(string name, Doctrine_Record|Doctrine_Collection value)

Places a related component in the object graph.

integer

count()

implements Countable interface.

boolean

delete(mixed conn)

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

void

deleteNode()

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

void|Doctrine_Validator_ErrorStack

errorStack(mixed stack, Doctrine_Validator_ErrorStack errorStack)

assigns the ErrorStack or returns it if called without parameters.

boolean

exists()

returns true if this record is saved in the database, otherwise false (it is transient).

string

exportTo(string type, string deep)

exports instance to a chosen format.

void

free(boolean deep)

Helps freeing the memory occupied by the entity.

void

fromArray(string array, bool deep)

imports data from a php array.

mixed

get(mixed fieldName, boolean load, mixed offset)

returns a value of a property or a related component.

string

getAccessor(string fieldName)

gets the custom accessor for a field name.

array

getAccessors()

gets all accessors for this component instance.

array

getData()

return all the internal data (columns).

Doctrine_Validator_ErrorStack

getErrorStack()

retrieves the ErrorStack.

string

getErrorStackAsString()

Get the record error stack as a human readable string.

final integer

getIncremented()

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

Doctrine_Record_Iterator

getIterator()

implements IteratorAggregate interface.

Doctrine_Record

getLast()

getLast this method is used internally by Doctrine_Query it is needed to provide compatibility between records and collections.

array

getLastModified(boolean old)

returns an array of the modified fields from the last transaction..

array

getModified(boolean old, boolean last)

retrieves an array of modified fields and associated new values..

string

getMutator(mixed fieldName, string fieldname)

gets the custom mutator for a field name.

array

getMutators()

gets all custom mutators for this component instance.

Doctrine_Node

getNode()

getter for node associated with this record.

integer

getOid()

.

array

getPendingDeletes()

returns Doctrine_Record instances which need to be deleted on save.

array

getPendingUnlinks()

returns Doctrine_Record instances which need to be unlinked (deleting the relation) on save.

array

getPrepared(array array)

Retrieves data prepared for a sql transaction.

array

getReferences()

get all related components.

Doctrine_Table

getTable()

returns the table object for this record..

boolean

hasAccessor(string fieldName, string accessor)

sets a fieldname to have a custom accessor or check if a field has a custom accessor defined (when called without $accessor parameter)..

void

hasAccessorMutator(mixed fieldName, string accessor, string mutator, string fieldname)

Set a fieldname to have a custom accessor and mutator.

boolean

hasMappedValue(string name)

Tests whether a mapped value exists.

boolean

hasMutator(string fieldName, string mutator)

sets a fieldname to have a custom mutator or check if a field has a custom mutator defined (when called without the $mutator parameter).

boolean

hasReference(string name)

tests whether a relation is set.

boolean

hasRelation(mixed fieldName)

checks existence of properties and related components.

void

hydrate(array data, boolean overwriteLocalChanges)

hydrate hydrates this object from given array.

array

identifier()

returns the primary keys of this object.

void

importFrom(string type, string data, mixed deep)

imports data from a chosen format in the current instance.

Doctrine_Event

invokeSaveHooks(string when, string type, Doctrine_Event event)

calls a subclass hook.

boolean

isInProxyState()

indicates whether record has any not loaded fields.

boolean

isModified(boolean deep)

returns true if this record was modified, otherwise false.

boolean

isValid(boolean deep, boolean hooks)

tests validity of the record using the current data..

Doctrine_Record

link(string alias, array ids, boolean now)

creates links from this record to given records.

Doctrine_Record

linkInDb(string alias, array ids)

creates links from this record to given records now, querying the db.

boolean

load(array data)

loads all the uninitialized properties from the database.

void

loadReference(string name)

loadReference loads a related component.

void

mapValue(string name, mixed value)

sets a value that will be managed as if it were a field by magic accessor and mutators, @see get() and @see set().

void

merge(mixed data, bool deep, string array)

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

void

obtainReference(string name)

gets a related component and fails if it does not exist.

void

oid()

void

postDelete(mixed event)

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

void

postHydrate(mixed event)

Empty template method to provide Record classes with the ability to alter hydration after it runs.

void

postInsert(mixed 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..

void

postSave(mixed event)

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

void

postSerialize(mixed event)

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

void

postUnserialize(mixed event)

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

void

postUpdate(mixed 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..

void

postValidate(mixed event)

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

void

preDelete(mixed event)

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

void

preDqlDelete(mixed event)

Empty template method to provide Record classes with the ability to alter DQL delete queries at runtime.

void

preDqlSelect(mixed event)

Empty template method to provide Record classes with the ability to alter DQL select queries at runtime.

void

preDqlUpdate(mixed event)

Empty template method to provide Record classes with the ability to alter DQL update queries at runtime.

void

preHydrate(mixed event)

Empty template method to provide Record classes with the ability to alter hydration before it runs.

void

preInsert(mixed 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..

void

preSave(mixed event)

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

void

preSerialize(mixed event)

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

void

preUnserialize(mixed event)

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

void

preUpdate(mixed 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..

void

preValidate(mixed event)

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

mixed

rawGet(mixed fieldName, $name name)

returns the value of a property (column).

Doctrine_Record|Doctrine_Collection

reference(string name)

gets a related component.

boolean

refresh(bool deep)

refresh refresh internal data from the database.

Doctrine_Record

refreshRelated(string name)

refresh refresh data of related objects from the database.

boolean

relatedExists(string name)

Check if a related relationship exists.

integer

replace(Doctrine_Connection conn)

executes a SQL REPLACE query.

void

resetPendingUnlinks()

resets pending record unlinks.

void

save(Doctrine_Connection conn)

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.

string

serialize()

serialize this method is automatically called when an instance of Doctrine_Record is serialized.

boolean

serializeReferences(boolean bool)

Set whether or not to serialize references.

Doctrine_Record

set(mixed fieldName, mixed value, boolean load, mixed name, mixed offset)

alters mapped values, properties and related components..

final void

setRelated(string alias, Doctrine_Access coll)

set a related component.

void

setUp()

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

null|integer

state(integer|string state)

assigns the state of this record or returns it if called without parameters.

void

synchronizeWithArray(array array, bool deep)

synchronizes a Doctrine_Record instance and its relations with data from an array.

array

toArray(boolean deep, boolean prefixKey)

returns the record representation as an array.

string

toString()

__toString alias.

TRUE

trySave(Doctrine_Connection conn)

tries to save the object and all its related components.

Doctrine_Record

unlink(string alias, array ids, boolean now)

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

Doctrine_Record

unlinkInDb(string alias, array ids)

unlink now the related components, querying the db.

void

unserialize(string serialized)

this method is automatically called everytime an instance is unserialized.

void

unshiftFilter(mixed filter)

protected void

validate()

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

protected void

validateOnInsert()

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

protected void

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

Methods inherited from Doctrine\Doctrine_Record_Abstract
actAs, addListener, attribute, bindQueryParts, check, getListener, getTable, hasColumn, hasColumns, hasMany, hasOne, index, loadGenerator, option, setAttribute, setColumnOption, setColumnOptions, setInheritanceMap, setListener, setSubclasses, setTableDefinition, setTableName, setUp, unique
Methods inherited from Doctrine\Doctrine_Access
add, contains, get, offsetExists, offsetGet, offsetSet, offsetUnset, remove, set, setArray
Methods inherited from Doctrine\Doctrine_Locator_Injectable
bind, getLocator, getNullObject, initNullObject, locate, setLocator

Field Detail

/Doctrine/Record.php at line 58

STATE_CLEAN

public final int STATE_CLEAN = 3

CLEAN STATE a Doctrine_Record is in clean state when all of its properties are loaded from the database and none of its properties are changed


/Doctrine/Record.php at line 44

STATE_DIRTY

public final int STATE_DIRTY = 1

DIRTY STATE a Doctrine_Record is in dirty state when its properties are changed


/Doctrine/Record.php at line 79

STATE_LOCKED

public final int STATE_LOCKED = 6

LOCKED STATE a Doctrine_Record is temporarily locked during deletes and saves

This state is used internally to ensure that circular deletes and saves will not cause infinite loops


/Doctrine/Record.php at line 64

STATE_PROXY

public final int STATE_PROXY = 4

PROXY STATE a Doctrine_Record is in proxy state when its properties are not fully loaded


/Doctrine/Record.php at line 70

STATE_TCLEAN

public final int STATE_TCLEAN = 5

NEW TCLEAN a Doctrine_Record is in transient clean state when it is created and none of its fields are modified


/Doctrine/Record.php at line 51

STATE_TDIRTY

public final int STATE_TDIRTY = 2

TDIRTY STATE a Doctrine_Record is in transient dirty state when it is created and some of its fields are modified but it is NOT yet persisted into database


/Doctrine/Record.php at line 88

STATE_TLOCKED

public final int STATE_TLOCKED = 7

TLOCKED STATE a Doctrine_Record is temporarily locked (and transient) during deletes and saves

This state is used internally to ensure that circular deletes and saves will not cause infinite loops


/Doctrine/Record.php at line 167

_customAccessors

protected static array $_customAccessors = array()

Array of custom accessors for cache


/Doctrine/Record.php at line 174

_customMutators

protected static array $_customMutators = array()

Array of custom mutators for cache


/Doctrine/Record.php at line 109

_data

protected array $_data the record data $_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


/Doctrine/Record.php at line 141

_errorStack

protected Doctrine_Validator_ErrorStack error stack object $_errorStack


/Doctrine/Record.php at line 99

_id

protected integer $_id the primary keys of this object $_id = array()


/Doctrine/Record.php at line 188

_invokedSaveHooks

protected array $_invokedSaveHooks = false

Array containing the save hooks and events that have been invoked


/Doctrine/Record.php at line 125

_lastModified

protected array $_lastModified an array containing field names that were modified in the previous transaction $_lastModified = array()


/Doctrine/Record.php at line 131

_modified

protected array $_modified an array containing field names that have been modified $_modified = array()

Todo:
Better name? $_modifiedFields?

/Doctrine/Record.php at line 94

_node

protected Doctrine_Node_ node object $_node


/Doctrine/Record.php at line 136

_oldValues

protected array $_oldValues an array of the old values from set properties $_oldValues = array()


/Doctrine/Record.php at line 153

_pendingDeletes

protected string $_pendingDeletes = array()

Doctrine_Collection of objects needing to be deleted on save


/Doctrine/Record.php at line 160
protected array $_pendingUnlinks $_pendingUnlinks = array()

Array of pending un links in format alias => keys to be executed after save


/Doctrine/Record.php at line 146

_references

protected array $_references an array containing all the references $_references = array()


/Doctrine/Record.php at line 181

_serializeReferences

protected boolean $_serializeReferences = false

Whether or not to serialize references when a Doctrine_Record is serialized


/Doctrine/Record.php at line 120

_state

protected integer $_state the state of this record $_state

See Also:
constants

/Doctrine/Record.php at line 114

_values

protected array $_values the values array, aggregate values and such are mapped into this array $_values = array()


Constructor Detail

/Doctrine/Record.php at line 211

Doctrine_Record

public Doctrine_Record(Doctrine_Table|null table, boolean isNewEntry)

constructor

Parameters:
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
Throws:
if object is created using the new operator and there are no open connections
if the cleanData operation fails somehow

Method Detail

/Doctrine/Record.php at line 683

assignDefaultValues

public boolean assignDefaultValues(boolean overwrite)

setDefaultValues sets the default values for records internal data

Parameters:
overwrite - whether or not to overwrite the already set values

/Doctrine/Record.php at line 2231

assignIdentifier

public void assignIdentifier(mixed id)

assigns an identifier to the instance, for database storage

Parameters:
id - a key value or an array of keys

/Doctrine/Record.php at line 663

assignInheritanceValues

public void assignInheritanceValues()

Assign the inheritance column values


/Doctrine/Record.php at line 2376

call

public Doctrine_Record call(string|array callback, string column, mixed arg1)

call

Parameters:
callback - valid callback
column - column name
arg1 - ... argN optional callback arguments
Returns:
provides a fluent interface

/Doctrine/Record.php at line 712

cleanData

public array cleanData(array 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.

Parameters:
data - data array to be cleaned
Returns:
values cleaned from data

/Doctrine/Record.php at line 1229

clearAccessor

public void clearAccessor(string fieldName)

clears the accessor for a field name


/Doctrine/Record.php at line 368

clearInvokedSaveHooks

public void clearInvokedSaveHooks()

makes all the already used save hooks available again


/Doctrine/Record.php at line 1298

clearMutator

public void clearMutator(string fieldName)

clears the custom mutator for a field name


/Doctrine/Record.php at line 1060

clearRelated

public void clearRelated(string name)

Clear a related reference or all references

Parameters:
name - The relationship reference to clear

/Doctrine/Record.php at line 1879

columnCount

public integer columnCount()

alias for @see count()

Returns:
the number of columns in this record

/Doctrine/Record.php at line 313

construct

public void construct()

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


/Doctrine/Record.php at line 1631

contains

public boolean contains(string fieldName, mixed offset)

test whether a field (column, mapped value, related component, accessor) is accessible by @see get()


/Doctrine/Record.php at line 2191

copy

public Doctrine_Record copy(boolean deep)

generates a copy of this object. Returns an instance of the same class of $this.

Parameters:
deep - whether to duplicates the objects targeted by the relations

/Doctrine/Record.php at line 1569

coreSetRelated

public void coreSetRelated(string name, Doctrine_Record|Doctrine_Collection value)

Places a related component in the object graph.

This method inserts a related component instance in this record relations, populating the foreign keys accordingly.

Parameters:
name - related component alias in the relation
value - object to be linked as a related component
Todo:
Refactor. What about composite keys?

/Doctrine/Record.php at line 1869

count

public integer count()

implements Countable interface

Returns:
the number of columns in this record

/Doctrine/Record.php at line 2177

delete

public boolean delete(mixed conn)

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

Returns:
true if successful

/Doctrine/Record.php at line 2665

deleteNode

public void deleteNode()

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


/Doctrine/Record.php at line 646

errorStack

public void|Doctrine_Validator_ErrorStack errorStack(mixed stack, Doctrine_Validator_ErrorStack errorStack)

assigns the ErrorStack or returns it if called without parameters

Parameters:
errorStack - to be assigned for this record
Returns:
returns the errorStack associated with this record

/Doctrine/Record.php at line 2103

exists

public boolean exists()

returns true if this record is saved in the database, otherwise false (it is transient)


/Doctrine/Record.php at line 2073

exportTo

public string exportTo(string type, string deep)

exports instance to a chosen format

Parameters:
type - format type: array, xml, yml, json
deep - whether or not to export all relationships
Returns:
representation as $type format. Array is $type is array

/Doctrine/Record.php at line 2678

free

public void free(boolean deep)

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.

Parameters:
deep - whether to free also the related components

/Doctrine/Record.php at line 1970

fromArray

public void fromArray(string array, bool deep)

imports data from a php array

See Also:
http://www.doctrine-project.org/documentation/manual/1_1/en/working-with-models
Parameters:
array - array of data, see link for documentation
deep - whether or not to act on relations

/Doctrine/Record.php at line 1336

get

public mixed get(mixed fieldName, boolean load, mixed offset)

returns a value of a property or a related component

Parameters:
fieldName - name of the property or related component
load - whether or not to invoke the loading procedure
Throws:
if trying to get a value of unknown property / related component

/Doctrine/Record.php at line 1241

getAccessor

public string getAccessor(string fieldName)

gets the custom accessor for a field name

Returns:
$accessor

/Doctrine/Record.php at line 1254

getAccessors

public array getAccessors()

gets all accessors for this component instance

Returns:
$accessors

/Doctrine/Record.php at line 1117

getData

public array getData()

return all the internal data (columns)

Returns:
an array containing all the properties

/Doctrine/Record.php at line 631

getErrorStack

public Doctrine_Validator_ErrorStack getErrorStack()

retrieves the ErrorStack. To be called after a failed validation attempt (@see isValid()).

Returns:
returns the errorStack associated with this record

/Doctrine/Record.php at line 609

getErrorStackAsString

public string getErrorStackAsString()

Get the record error stack as a human readable string. Useful for outputting errors to user via web browser

Returns:
$message

/Doctrine/Record.php at line 2274

getIncremented

public final integer getIncremented()

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

Todo:
Better name?

/Doctrine/Record.php at line 2164

getIterator

public Doctrine_Record_Iterator getIterator()

implements IteratorAggregate interface

Returns:
iterator through data

/Doctrine/Record.php at line 2292

getLast

public Doctrine_Record getLast()

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


/Doctrine/Record.php at line 1794

getLastModified

public array getLastModified(boolean old)

returns an array of the modified fields from the last transaction.

Parameters:
old - pick the old values (instead of the new ones)

/Doctrine/Record.php at line 1771

getModified

public array getModified(boolean old, boolean last)

retrieves an array of modified fields and associated new values.

Parameters:
old - pick the old values (instead of the new ones)
last - pick only lastModified values (@see getLastModified())
Returns:
$a

/Doctrine/Record.php at line 1284

getMutator

public string getMutator(mixed fieldName, string fieldname)

gets the custom mutator for a field name


/Doctrine/Record.php at line 1309

getMutators

public array getMutators()

gets all custom mutators for this component instance

Returns:
$mutators

/Doctrine/Record.php at line 2397

getNode

public Doctrine_Node getNode()

getter for node associated with this record

Returns:
false if component is not a Tree

/Doctrine/Record.php at line 321

getOid

public integer getOid()

See Also:
$_oid;
Returns:
the object identifier

/Doctrine/Record.php at line 1677

getPendingDeletes

public array getPendingDeletes()

returns Doctrine_Record instances which need to be deleted on save


/Doctrine/Record.php at line 1687

getPendingUnlinks

public array getPendingUnlinks()

returns Doctrine_Record instances which need to be unlinked (deleting the relation) on save

Returns:
$pendingUnlinks

/Doctrine/Record.php at line 1810

getPrepared

public array getPrepared(array array)

Retrieves data prepared for a sql transaction.

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

Todo:
What about a little bit more expressive name? getPreparedData?

/Doctrine/Record.php at line 2338

getReferences

public array getReferences()

get all related components

Returns:
various Doctrine_Collection or Doctrine_Record instances

/Doctrine/Record.php at line 1107

getTable

public Doctrine_Table getTable()

returns the table object for this record.

Returns:
a Doctrine_Table object

/Doctrine/Record.php at line 1213

hasAccessor

public boolean hasAccessor(string fieldName, string accessor)

sets a fieldname to have a custom accessor or check if a field has a custom accessor defined (when called without $accessor parameter).


/Doctrine/Record.php at line 1322

hasAccessorMutator

public void hasAccessorMutator(mixed fieldName, string accessor, string mutator, string fieldname)

Set a fieldname to have a custom accessor and mutator


/Doctrine/Record.php at line 1426

hasMappedValue

public boolean hasMappedValue(string name)

Tests whether a mapped value exists

Parameters:
name - the name of the property

/Doctrine/Record.php at line 1268

hasMutator

public boolean hasMutator(string fieldName, string mutator)

sets a fieldname to have a custom mutator or check if a field has a custom mutator defined (when called without the $mutator parameter)


/Doctrine/Record.php at line 2302

hasReference

public boolean hasReference(string name)

tests whether a relation is set

Parameters:
name - relation alias

/Doctrine/Record.php at line 2152

hasRelation

public boolean hasRelation(mixed fieldName)

checks existence of properties and related components

Parameters:
fieldName - name of the property or reference

/Doctrine/Record.php at line 739

hydrate

public void hydrate(array data, boolean overwriteLocalChanges)

hydrate hydrates this object from given array

Parameters:
overwriteLocalChanges - whether to overwrite the unsaved (dirty) data

/Doctrine/Record.php at line 2263

identifier

public array identifier()

returns the primary keys of this object


/Doctrine/Record.php at line 2089

importFrom

public void importFrom(string type, string data, mixed deep)

imports data from a chosen format in the current instance

Parameters:
type - Format type: xml, yml, json
data - Data to be parsed and imported

/Doctrine/Record.php at line 343

invokeSaveHooks

public Doctrine_Event invokeSaveHooks(string when, string type, Doctrine_Event event)

calls a subclass hook. Idempotent until @see clearInvokedSaveHooks() is called.

$this->invokeSaveHooks('pre', 'save');

Parameters:
when - 'post' or 'pre'
type - serialize, unserialize, save, delete, update, insert, validate, dqlSelect, dqlDelete, hydrate
event - event raised
Returns:
the event generated using the type, if not specified

/Doctrine/Record.php at line 1191

isInProxyState

public boolean isInProxyState()

indicates whether record has any not loaded fields


/Doctrine/Record.php at line 2117

isModified

public boolean isModified(boolean deep)

returns true if this record was modified, otherwise false

Parameters:
deep - whether to process also the relations for changes

/Doctrine/Record.php at line 380

isValid

public boolean isValid(boolean deep, boolean hooks)

tests validity of the record using the current data.

Parameters:
deep - run the validation process on the relations
hooks - invoke save hooks before start
Returns:
whether or not this record is valid

/Doctrine/Record.php at line 2511

link

public Doctrine_Record link(string alias, array ids, boolean now)

creates links from this record to given records

Parameters:
alias - related component alias
ids - the identifiers of the related records
now - wether or not to execute now or set pending
Returns:
this object (fluent interface)

/Doctrine/Record.php at line 2556

linkInDb

public Doctrine_Record linkInDb(string alias, array ids)

creates links from this record to given records now, querying the db

Parameters:
alias - related component alias
ids - the identifiers of the related records
Returns:
this object (fluent interface)

/Doctrine/Record.php at line 1149

load

public boolean load(array data)

loads all the uninitialized properties from the database. Used to move a record from PROXY to CLEAN/DIRTY state.

Parameters:
data - overwriting data to load in the record. Instance is hydrated from the table if not specified.

/Doctrine/Record.php at line 2362

loadReference

public void loadReference(string name)

loadReference loads a related component

Throws:
if trying to load an unknown related component
Parameters:
name - alias of the relation

/Doctrine/Record.php at line 1415

mapValue

public void mapValue(string name, mixed value)

sets a value that will be managed as if it were a field by magic accessor and mutators, @see get() and @see set(). Normally used by Doctrine for the mapping of aggregate values.

Parameters:
name - the name of the mapped value
value - mixed value to be mapped

/Doctrine/Record.php at line 1951

merge

public void merge(mixed data, bool deep, string array)

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

See Also:
fromArray()
See Also:
http://www.doctrine-project.org/documentation/manual/1_1/en/working-with-models
Parameters:
array - array of data to merge, see link for documentation
deep - whether or not to merge relations

/Doctrine/Record.php at line 2326

obtainReference

public void obtainReference(string name)

gets a related component and fails if it does not exist

Throws:
if trying to get an unknown related component

/Doctrine/Record.php at line 326

oid

public void oid()

/Doctrine/Record.php at line 519

postDelete

public void postDelete(mixed event)

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


/Doctrine/Record.php at line 600

postHydrate

public void postHydrate(mixed event)

Empty template method to provide Record classes with the ability to alter hydration after it runs


/Doctrine/Record.php at line 551

postInsert

public void postInsert(mixed 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.


/Doctrine/Record.php at line 505

postSave

public void postSave(mixed event)

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


/Doctrine/Record.php at line 477

postSerialize

public void postSerialize(mixed event)

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


/Doctrine/Record.php at line 491

postUnserialize

public void postUnserialize(mixed event)

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


/Doctrine/Record.php at line 535

postUpdate

public void postUpdate(mixed 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.


/Doctrine/Record.php at line 565

postValidate

public void postValidate(mixed event)

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


/Doctrine/Record.php at line 512

preDelete

public void preDelete(mixed event)

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


/Doctrine/Record.php at line 586

preDqlDelete

public void preDqlDelete(mixed event)

Empty template method to provide Record classes with the ability to alter DQL delete queries at runtime


/Doctrine/Record.php at line 572

preDqlSelect

public void preDqlSelect(mixed event)

Empty template method to provide Record classes with the ability to alter DQL select queries at runtime


/Doctrine/Record.php at line 579

preDqlUpdate

public void preDqlUpdate(mixed event)

Empty template method to provide Record classes with the ability to alter DQL update queries at runtime


/Doctrine/Record.php at line 593

preHydrate

public void preHydrate(mixed event)

Empty template method to provide Record classes with the ability to alter hydration before it runs


/Doctrine/Record.php at line 543

preInsert

public void preInsert(mixed 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.


/Doctrine/Record.php at line 498

preSave

public void preSave(mixed event)

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


/Doctrine/Record.php at line 470

preSerialize

public void preSerialize(mixed event)

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


/Doctrine/Record.php at line 484

preUnserialize

public void preUnserialize(mixed event)

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


/Doctrine/Record.php at line 527

preUpdate

public void preUpdate(mixed 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.


/Doctrine/Record.php at line 559

preValidate

public void preValidate(mixed 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.


/Doctrine/Record.php at line 1130

rawGet

public mixed rawGet(mixed fieldName, $name name)

returns the value of a property (column). If the property is not yet loaded this method does NOT load it.

Parameters:
name - of the property
Throws:
if trying to get an unknown property

/Doctrine/Record.php at line 2313

reference

public Doctrine_Record|Doctrine_Collection reference(string name)

gets a related component


/Doctrine/Record.php at line 967

refresh

public boolean refresh(bool deep)

refresh refresh internal data from the database

Parameters:
deep - If true, fetch also current relations. Caution: this deletes any aggregated values you may have queried beforee
Throws:
When the refresh operation fails (when the database row this record represents does not exist anymore)

/Doctrine/Record.php at line 1021

refreshRelated

public Doctrine_Record refreshRelated(string name)

refresh refresh data of related objects from the database

Parameters:
name - name of a related component. if set, this method only refreshes the specified related component
Returns:
this object

/Doctrine/Record.php at line 1077

relatedExists

public boolean relatedExists(string name)

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.

Returns:
Whether or not the related relationship exists

/Doctrine/Record.php at line 1756

replace

public integer replace(Doctrine_Connection conn)

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.

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.

Parameters:
conn - optional connection parameter
Throws:
if some of the key values was null
if there were no key fields
if something fails at database level
Returns:
number of rows affected

/Doctrine/Record.php at line 1697

resetPendingUnlinks

public void resetPendingUnlinks()

resets pending record unlinks


/Doctrine/Record.php at line 1713

save

public void save(Doctrine_Connection conn)

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

Parameters:
conn - optional connection parameter
Throws:
if record is not valid and validation is active

/Doctrine/Record.php at line 799

serialize

public string serialize()

serialize this method is automatically called when an instance of Doctrine_Record is serialized


/Doctrine/Record.php at line 279

serializeReferences

public boolean serializeReferences(boolean bool)

Set whether or not to serialize references. This is used by caching since we want to serialize references when caching but not when just normally serializing a instance

Returns:
$bool

/Doctrine/Record.php at line 1443

set

public Doctrine_Record set(mixed fieldName, mixed value, boolean load, mixed name, mixed offset)

alters mapped values, properties and related components.

Parameters:
name - name of the property or reference
value - value of the property or reference
load - whether or not to refresh / load the uninitialized record data
Throws:
if trying to set a value for unknown property / related component
if trying to set a value of wrong type for related component

/Doctrine/Record.php at line 2349

setRelated

public final void setRelated(string alias, Doctrine_Access coll)

set a related component


/Doctrine/Record.php at line 304

setUp

public void setUp()

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


/Doctrine/Record.php at line 922

state

public null|integer state(integer|string state)

assigns the state of this record or returns it if called without parameters

Parameters:
state - if set, this method tries to set the record state to $state
See Also:
constants
Throws:
if trying to set an unknown state

/Doctrine/Record.php at line 2023

synchronizeWithArray

public void synchronizeWithArray(array array, bool deep)

synchronizes a Doctrine_Record instance 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 but available on the Doctrine_Record (unlike @see fromArray() that does not touch what it is not in $array)

Parameters:
array - representation of a Doctrine_Record
deep - whether or not to act on relations

/Doctrine/Record.php at line 1892

toArray

public array toArray(boolean deep, boolean prefixKey)

returns the record representation as an array

See Also:
http://www.doctrine-project.org/documentation/manual/1_1/en/working-with-models
Parameters:
deep - whether to include relations
prefixKey - not used

/Doctrine/Record.php at line 2705

toString

public string toString()

__toString alias


/Doctrine/Record.php at line 1730

trySave

public TRUE trySave(Doctrine_Connection conn)

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.

Parameters:
conn - optional connection parameter
Returns:
if the record was saved sucessfully without errors, FALSE otherwise.

/Doctrine/Record.php at line 2428

unlink

public Doctrine_Record unlink(string alias, array ids, boolean now)

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

Parameters:
alias - related component alias
ids - the identifiers of the related records
now - whether or not to execute now or set as pending unlinks
Returns:
this object (fluent interface)

/Doctrine/Record.php at line 2473

unlinkInDb

public Doctrine_Record unlinkInDb(string alias, array ids)

unlink now the related components, querying the db

Parameters:
alias - related component alias
ids - the identifiers of the related records
Returns:
this object (fluent interface)

/Doctrine/Record.php at line 857

unserialize

public void unserialize(string serialized)

this method is automatically called everytime an instance is unserialized

Parameters:
serialized - Doctrine_Record as serialized string
Throws:
if the cleanData operation fails somehow

/Doctrine/Record.php at line 2413

unshiftFilter

public void unshiftFilter(mixed filter)

/Doctrine/Record.php at line 447

validate

protected void 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.


/Doctrine/Record.php at line 463

validateOnInsert

protected void 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.


/Doctrine/Record.php at line 455

validateOnUpdate

protected void 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.


Doctrine