Doctrine


Doctrine\ORM\Persisters\StandardEntityPersister
/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 43

Class StandardEntityPersister

StandardEntityPersister

public class StandardEntityPersister

A basic entity persister that maps an entity with no (mapped) inheritance to a single table in the relational database.

Author:
Roman Borschel
Giorgio Sironi
License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
Since:
2.0
Todo:
Rename: BasicEntityPersister

Field Summary
protected Doctrine\ORM\Mapping\ClassMetadata

$_class

Metadata object that describes the mapping of the mapped entity class.

protected array

$_columnTypes

The map of column names to DBAL mapping types of all prepared columns used when INSERTing or UPDATEing an entity.

protected Doctrine\DBAL\Connection $conn

$_conn

The underlying Connection of the used EntityManager.

protected Doctrine\ORM\EntityManager

$_em

The EntityManager instance.

protected AbstractPlatform

$_platform

The database platform.

protected array

$_queuedInserts

Queued inserts.

protected array

$_resultColumnNames

Case-sensitive mappings of column names as they appear in an SQL result set to column names as they are defined in the mapping.

protected string

$_selectColumnListSql

The SELECT column list SQL fragment used for querying entities by this persister.

protected integer

$_sqlAliasCounter

Counter for creating unique SQL table and column aliases.

protected array

$_sqlTableAliases

Map from class names (FQCN) to the corresponding generated SQL table aliases.

Constructor Summary

StandardEntityPersister(Doctrine\ORM\EntityManager em, Doctrine\ORM\Mapping\ClassMetadata class)

Initializes a new StandardEntityPersister that uses the given EntityManager and persists instances of the class described by the given ClassMetadata descriptor.

Method Summary
void

addInsert(object entity)

Adds an entity to the queued insertions.

void

delete(object entity)

Deletes an entity.

array

executeInserts()

Executes all queued entity insertions and returns any generated post-insert identifiers that were created as a result of the insertions.

Doctrine\ORM\Mapping\ClassMetadata

getClassMetadata()

Gets the ClassMetadata instance of the entity class this persister is used for.

string

getInsertSQL()

Gets the INSERT SQL used by the persister to persist a new entity.

string

getOwningTable(string fieldName)

Gets the name of the table that owns the column the given field is mapped to.

The

load(array criteria, object entity, mixed assoc, array hints, $assoc The)

Loads an entity by a list of field criteria.

array

loadAll(array criteria)

Loads a list of entities by a list of field criteria.

void

loadManyToManyCollection(ManyToManyMapping assoc, array criteria, PersistentCollection coll)

Loads a collection of entities of a many-to-many association.

void

loadOneToManyCollection(OneToManyMapping assoc, array criteria, mixed coll, PersistentCollection The)

Loads a collection of entities in a one-to-many association.

void

refresh(array id, object entity)

Refreshes an entity.

void

update(object entity)

Updates an entity.

Field Detail

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 50

_class

protected Doctrine\ORM\Mapping\ClassMetadata $_class

Metadata object that describes the mapping of the mapped entity class.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 97

_columnTypes

protected array $_columnTypes = array()

The map of column names to DBAL mapping types of all prepared columns used when INSERTing or UPDATEing an entity.

See Also:
_prepareInsertData($entity)
_prepareUpdateData($entity)

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 57

_conn

protected Doctrine\DBAL\Connection $conn $_conn

The underlying Connection of the used EntityManager.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 71

_em

protected Doctrine\ORM\EntityManager $_em

The EntityManager instance.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 64

_platform

protected AbstractPlatform $_platform

The database platform.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 78

_queuedInserts

protected array $_queuedInserts = array()

Queued inserts.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 87

_resultColumnNames

protected array $_resultColumnNames = array()

Case-sensitive mappings of column names as they appear in an SQL result set to column names as they are defined in the mapping. This is necessary because different RDBMS vendors return column names in result sets in different casings.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 113

_selectColumnListSql

protected string $_selectColumnListSql

The SELECT column list SQL fragment used for querying entities by this persister. This SQL fragment is only generated once per request, if at all.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 120

_sqlAliasCounter

protected integer $_sqlAliasCounter

Counter for creating unique SQL table and column aliases.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 127

_sqlTableAliases

protected array $_sqlTableAliases = array()

Map from class names (FQCN) to the corresponding generated SQL table aliases.


Constructor Detail

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 136

StandardEntityPersister

public StandardEntityPersister(Doctrine\ORM\EntityManager em, Doctrine\ORM\Mapping\ClassMetadata class)

Initializes a new StandardEntityPersister that uses the given EntityManager and persists instances of the class described by the given ClassMetadata descriptor.


Method Detail

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 150

addInsert

public void addInsert(object entity)

Adds an entity to the queued insertions. The entity remains queued until executeInserts() is invoked.

Parameters:
entity - The entitiy to queue for insertion.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 302

delete

public void delete(object entity)

Deletes an entity.

Parameters:
entity - The entity to delete.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 164

executeInserts

public array executeInserts()

Executes all queued entity insertions and returns any generated post-insert identifiers that were created as a result of the insertions.

If no inserts are queued, invoking this method is a NOOP.

Returns:
An array of any generated post-insert IDs. This will be an empty array if the entity class does not use the IDENTITY generation strategy.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 316

getClassMetadata

public Doctrine\ORM\Mapping\ClassMetadata getClassMetadata()

Gets the ClassMetadata instance of the entity class this persister is used for.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 792

getInsertSQL

public string getInsertSQL()

Gets the INSERT SQL used by the persister to persist a new entity.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 413

getOwningTable

public string getOwningTable(string fieldName)

Gets the name of the table that owns the column the given field is mapped to.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 428

load

public The load(array criteria, object entity, mixed assoc, array hints, $assoc The)

Loads an entity by a list of field criteria.

Parameters:
criteria - The criteria by which to load the entity.
entity - The entity to load the data into. If not specified, a new entity is created.
The - association that connects the entity to load to another entity, if any.
hints - Hints for entity creation.
Returns:
loaded entity instance or NULL if the entity/the data can not be found.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 527

loadAll

public array loadAll(array criteria)

Loads a list of entities by a list of field criteria.


/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 570

loadManyToManyCollection

public void loadManyToManyCollection(ManyToManyMapping assoc, array criteria, PersistentCollection coll)

Loads a collection of entities of a many-to-many association.

Parameters:
coll - The collection to fill.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 551

loadOneToManyCollection

public void loadOneToManyCollection(OneToManyMapping assoc, array criteria, mixed coll, PersistentCollection The)

Loads a collection of entities in a one-to-many association.

Parameters:
criteria - The criteria by which to select the entities.
The - collection to fill.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 445

refresh

public void refresh(array id, object entity)

Refreshes an entity.

Parameters:
id - The identifier of the entity as an associative array from column names to values.
entity - The entity to refresh.

/Doctrine/ORM/Persisters/StandardEntityPersister.php at line 233

update

public void update(object entity)

Updates an entity.

Parameters:
entity - The entity to update.

Doctrine