Development Doctrine_Entity
Doctrine Entity
Base class for all Entities (objects with persistent state in a RDBMS that are managed by Doctrine).
NOTE: Methods that are intended for internal use only but must be public are marked INTERNAL: and begin with an underscore "_" to indicate that they ideally would not be public and to minimize naming collisions.
Inheritence
Doctrine_Entity < Doctrine_Access
Direct Sub-Classes
Method Summary
| Returns | Name | Description |
|---|---|---|
| boolean | contains | NOTE: Invoked by Doctrine::ORM::Access#__isset(). |
| copy | ||
| boolean | delete | Triggered events: onPreDelete, onDelete. |
| 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 | ||
| mixed | get | |
| Doctrine::ORM::Mapping::ClassMetadata | getClass | |
| string | getClassName | |
| array | getData | |
| Doctrine::ORM::EntityManager | getEntityManager | |
| array | getModifiedFields | |
| integer | getOid | |
| array | getPrepared | |
| Doctrine::ORM::EntityRepository | getRepository | |
| boolean | hasReference | |
| boolean | hydrate | |
| importFrom | ||
| boolean | isModified | |
| boolean | isNew | |
| link | ||
| merge | ||
| obtainReference | ||
| boolean | refresh | |
| remove | NOTE: Invoked by Doctrine::ORM::Access#__unset(). | |
| integer | replace | The REPLACE type of query does not make part of the SQL standards. Since practically only MySQL and SQLIte implement it natively, this type of query isemulated through this method for other DBMS using standard types of queries inside a transaction to a |
| revert | ||
| save | This method also saves associated entities. | |
| array | serialize | This method is automatically called when the entity is serialized. Part of the implementation of the Serializable interface. |
| set | ||
| synchronizeFromArray | It expects an array representation of a Doctrine_Entity 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 | ||
| unlink | ||
| unserialize | This method is automatically called everytime the entity is unserialized. | |
| _assignIdentifier | ||
| array | _getReferences | getReferences |
| array | _identifier | |
| mixed | _rawGet | Gets the value of a field (regular field or reference). If the field is not yet loaded this method does NOT load it. NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. |
| mixed | _rawGetField | NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the field exists. _rawGet() in extending classes should be preferred. |
| _rawGetReference | NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the reference exists. | |
| mixed | _rawSet | Sets the value of a field (regular field or reference). If the field is not yet loaded this method does NOT load it. NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. |
| _rawSetField | NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the field exists. _rawSet() in extending classes should be preferred. | |
| _rawSetReference | NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. | |
| _setIdentifier | ||
| _setRelated | ||
| _state | ||
| __construct | Creates a new Entity instance. | |
| __toString |
Methods inherited from Doctrine_Access
__isset , add , offsetUnset , offsetSet , offsetGet , contains , get , offsetExists , __get , __unset , setArray , set , remove , __setMethod Details
-
(boolean) contains($fieldName, $name)
Checks whether a field is set (not null).
NOTE: Invoked by Doctrine::ORM::Access#__isset().
-
copy($deep = true)
Creates a copy of the entity.
-
(boolean) delete(( ) $conn = null)
Deletes the entity.
Triggered events: onPreDelete, onDelete.
Doctrine_Entity
-
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.
-
$deep Bool value for whether or not to merge the data deep fromArray($array, $deep = true)
-
$name name of the property or related component $load whether or not to invoke the loading procedure (mixed) get($fieldName, $name, $load)
Generic getter.
throws Doctrine_Record_Exception if trying to get a value of unknown property / related component
-
(Doctrine::ORM::Mapping::ClassMetadata) getClass()
Gets the ClassMetadata object that describes the entity class.
-
(string) getClassName()
Gets the entity class name.
-
(array) getData()
Gets the current field values.
Doctrine_Entity
-
(Doctrine::ORM::EntityManager) getEntityManager()
Gets the EntityManager that is responsible for the persistence of the Entity.
-
(array) getModifiedFields()
Gets the names and values of all fields that have been modified since the entity was last synch'd with the database.
-
(integer) getOid()
Returns the object identifier.
-
(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
-
(Doctrine::ORM::EntityRepository) getRepository()
Gets the EntityRepository of the Entity.
-
(boolean) hasReference($name)
hasRefence
-
(boolean) hydrate($data)
Hydrates this object from given array
-
importFrom($type, $data)
-
(boolean) isModified()
Checks whether the entity has been modified since it was last synchronized with the database.
Doctrine_Entity
-
(boolean) isNew()
Checks whether the entity already has a persistent state.
Doctrine_Entity
-
$alias related component alias $ids the identifiers of the related records link($alias, $ids)
Creates links from this record to given records.
Doctrine_Entity
-
$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 Entity with an array of values or with another existing instance of.
-
obtainReference($name)
throws Doctrine_Record_Exception if trying to get an unknown related component
-
$deep If true, fetch also current relations. Caution: this deletes any aggregated values you may have queried beforee (boolean) refresh($deep = false)
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)
-
remove($fieldName, $name)
Clears the value of a field.
NOTE: Invoked by Doctrine::ORM::Access#__unset().
-
$conn optional connection parameter (integer) replace((Doctrine_Connection) $conn)
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 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 a
Doctrine_Entity
throws Doctrine_Connection_Exception if something fails at database level
-
$version an integer > 1 revert($version)
revert reverts this record to given version, this method only works if versioning plugin is enabled
Doctrine_Entity
throws Doctrine_Record_Exception if given version does not exist
-
$conn optional connection parameter save((Doctrine_Connection) $conn)
Saves the current state of the entity into the database.
This method also saves associated entities.
-
(array) serialize()
Serializes the entity.
This method is automatically called when the entity is serialized.
Part of the implementation of the Serializable interface.
-
$value value of the property or reference $name name of the property or reference set($fieldName, $value, $name)
Generic setter.
-
$array representation of a Doctrine_Entity synchronizeFromArray($array)
Synchronizes a Doctrine_Entity and its relations with data from an array
It expects an array representation of a Doctrine_Entity 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)
Creates an array representation of the object's data.
-
toString()
-
$alias related component alias $ids the identifiers of the related records unlink($alias, $ids = array())
Removes links from this record to given records if no ids are given, it removes all links
Doctrine_Entity
-
$serialized Doctrine_Entity as serialized string unserialize($serialized)
Reconstructs the entity from it's serialized form.
This method is automatically called everytime the entity is unserialized.
throws Doctrine_Record_Exception if the cleanData operation fails somehow
-
_assignIdentifier($id)
INTERNAL: Assigns an identifier to the entity. This is only intended for use by the EntityPersisters or the UnitOfWork.
-
(array) _getReferences()
INTERNAL:
getReferences
Doctrine_Entity
-
(array) _identifier()
INTERNAL: Returns the primary keys of the entity (key => value pairs).
-
$fieldName name of the property (mixed) _rawGet(($name) $fieldName)
INTERNAL: (Usage from within extending classes is intended)
Gets the value of a field (regular field or reference). If the field is not yet loaded this method does NOT load it.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged.throws Doctrine_Entity_Exception if trying to get an unknown field
-
(mixed) _rawGetField($fieldName)
INTERNAL: Gets the value of a field.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the field exists. _rawGet() in extending classes should be preferred.
-
_rawGetReference((unknown_type) $fieldName)
Gets a reference to another Entity.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the reference exists.
-
$fieldName name of the field (mixed) _rawSet(($name) $fieldName, $value)
INTERNAL: (Usage from within extending classes is intended)
Sets the value of a field (regular field or reference). If the field is not yet loaded this method does NOT load it.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged.throws Doctrine_Entity_Exception if trying to get an unknown field
-
_rawSetField($fieldName, $value)
INTERNAL: Sets the value of a field.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged. This method does NOT check whether the field exists. _rawSet() in extending classes should be preferred.
-
_rawSetReference($name, $value, $fieldName)
INTERNAL: Sets a reference to another Entity.
NOTE: Use of this method from outside the scope of an extending class is strongly discouraged.
-
_setIdentifier($identifier)
INTERNAL:
-
_setRelated($alias, ( ) $coll)
INTERNAL: setRelated
-
$state if set, this method tries to set the record state to $state _state((integer|string) $state = null)
INTERNAL: Gets or sets the state of this Entity.
throws Doctrine_Record_State_Exception if trying to set an unknown state
-
__construct()
Constructor.
Creates a new Entity instance.
-
__toString()
returns a string representation of this object