mediatekformation

EntityPersister

Entity persister interface Define the behavior that should be implemented by all entity persisters.

Table of Contents

addInsert()  : void
Adds an entity to the queued insertions.
count()  : int
Count entities (optionally filtered by a criteria)
delete()  : bool
Deletes a managed entity.
executeInserts()  : mixed
Executes all queued entity insertions and returns any generated post-insert identifiers that were created as a result of the insertions.
exists()  : bool
Checks whether the given managed entity exists in the database.
expandCriteriaParameters()  : mixed
Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.
expandParameters()  : mixed
Expands the parameters from the given criteria and use the correct binding types if found.
getClassMetadata()  : ClassMetadata
getCountSQL()  : string
Get the COUNT SQL to count entities (optionally based on a criteria)
getInserts()  : mixed
Get all queued inserts.
getInsertSQL()  : string
getManyToManyCollection()  : array<string|int, mixed>
Gets (sliced or full) elements of the given collection.
getOneToManyCollection()  : array<string|int, mixed>
Returns an array with (sliced or full list) of elements in the specified collection.
getOwningTable()  : string
Gets the name of the table that owns the column the given field is mapped to.
getResultSetMapping()  : ResultSetMapping
Gets the ResultSetMapping used for hydration.
getSelectConditionStatementSQL()  : string
Gets the SQL WHERE condition for matching a field with a given value.
getSelectSQL()  : string
Gets the SELECT SQL to select one or more entities by a set of field criteria.
load()  : object|null
Loads an entity by a list of field criteria.
loadAll()  : mixed
Loads a list of entities by a list of field criteria.
loadById()  : object|null
Loads an entity by identifier.
loadCriteria()  : array<string|int, mixed>
Loads Entities matching the given Criteria object.
loadManyToManyCollection()  : array<string|int, mixed>
Loads a collection of entities of a many-to-many association.
loadOneToManyCollection()  : mixed
Loads a collection of entities in a one-to-many association.
loadOneToOneEntity()  : object
Loads an entity of this persister's mapped class as part of a single-valued association from another entity.
lock()  : void
Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.
refresh()  : void
Refreshes a managed entity.
update()  : void
Updates a managed entity. The entity is updated according to its current changeset in the running UnitOfWork. If there is no changeset, nothing is updated.

Methods

addInsert()

Adds an entity to the queued insertions.

public addInsert(object $entity) : void

The entity remains queued until is invoked.

Parameters
$entity : object

The entity to queue for insertion.

Return values
void

count()

Count entities (optionally filtered by a criteria)

public count([array<string|int, mixed>|Criteria $criteria = [] ]) : int
Parameters
$criteria : array<string|int, mixed>|Criteria = []
Return values
int

delete()

Deletes a managed entity.

public delete(object $entity) : bool

The entity to delete must be managed and have a persistent identifier. The deletion happens instantaneously.

Subclasses may override this method to customize the semantics of entity deletion.

Parameters
$entity : object

The entity to delete.

Return values
bool

TRUE if the entity got deleted in the database, FALSE otherwise.

executeInserts()

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

public executeInserts() : mixed

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

Tags
psalm-return

list<array{ generatedId: int, entity: object }> 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.

Return values
mixed

exists()

Checks whether the given managed entity exists in the database.

public exists(object $entity[, Criteria|null $extraConditions = null ]) : bool
Parameters
$entity : object
$extraConditions : Criteria|null = null
Return values
bool

TRUE if the entity exists in the database, FALSE otherwise.

expandCriteriaParameters()

Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.

public expandCriteriaParameters(Criteria $criteria) : mixed
Parameters
$criteria : Criteria
Tags
psalm-return

array{list, list<int|string|null>}

Return values
mixed

expandParameters()

Expands the parameters from the given criteria and use the correct binding types if found.

public expandParameters(array<string|int, string> $criteria) : mixed
Parameters
$criteria : array<string|int, string>
Tags
psalm-return

array{list, list<int|string|null>}

Return values
mixed

getCountSQL()

Get the COUNT SQL to count entities (optionally based on a criteria)

public getCountSQL([array<string|int, mixed>|Criteria $criteria = [] ]) : string
Parameters
$criteria : array<string|int, mixed>|Criteria = []
Return values
string

getInserts()

Get all queued inserts.

public getInserts() : mixed
Tags
psalm-return

array<string|int, object>

Return values
mixed

getInsertSQL()

public getInsertSQL() : string
Tags
TODO
  • It should not be here. But its necessary since JoinedSubclassPersister#executeInserts invoke the root persister.

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

Return values
string

getManyToManyCollection()

Gets (sliced or full) elements of the given collection.

public getManyToManyCollection(array<string|int, mixed> $assoc, object $sourceEntity[, int|null $offset = null ][, int|null $limit = null ]) : array<string|int, mixed>
Parameters
$assoc : array<string|int, mixed>
$sourceEntity : object
$offset : int|null = null
$limit : int|null = null
Tags
psalm-param

array<string, mixed> $assoc

Return values
array<string|int, mixed>

getOneToManyCollection()

Returns an array with (sliced or full list) of elements in the specified collection.

public getOneToManyCollection(array<string|int, mixed> $assoc, object $sourceEntity[, int|null $offset = null ][, int|null $limit = null ]) : array<string|int, mixed>
Parameters
$assoc : array<string|int, mixed>
$sourceEntity : object
$offset : int|null = null
$limit : int|null = null
Tags
psalm-param

array<string, mixed> $assoc

Return values
array<string|int, mixed>

getOwningTable()

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

public getOwningTable(string $fieldName) : string

The default implementation in BasicEntityPersister always returns the name of the table the entity type of this persister is mapped to, since an entity is always persisted to a single table with a BasicEntityPersister.

Parameters
$fieldName : string

The field name.

Return values
string

The table name.

getSelectConditionStatementSQL()

Gets the SQL WHERE condition for matching a field with a given value.

public getSelectConditionStatementSQL(string $field, mixed $value[, array<string|int, mixed>|null $assoc = null ][, string|null $comparison = null ]) : string
Parameters
$field : string
$value : mixed
$assoc : array<string|int, mixed>|null = null
$comparison : string|null = null
Tags
psalm-param

array<string, mixed>|null $assoc

Return values
string

getSelectSQL()

Gets the SELECT SQL to select one or more entities by a set of field criteria.

public getSelectSQL(array<string|int, mixed>|Criteria $criteria[, array<string|int, mixed>|null $assoc = null ][, int|null $lockMode = null ][, int|null $limit = null ][, int|null $offset = null ][, array<string|int, mixed>|null $orderBy = null ]) : string
Parameters
$criteria : array<string|int, mixed>|Criteria
$assoc : array<string|int, mixed>|null = null
$lockMode : int|null = null
$limit : int|null = null
$offset : int|null = null
$orderBy : array<string|int, mixed>|null = null
Return values
string

load()

Loads an entity by a list of field criteria.

public load(array<string|int, mixed> $criteria[, object|null $entity = null ][, array<string|int, mixed>|null $assoc = null ][, array<string|int, mixed> $hints = [] ][, int|null $lockMode = null ][, int|null $limit = null ][, array<string|int, string>|null $orderBy = null ]) : object|null
Parameters
$criteria : array<string|int, mixed>

The criteria by which to load the entity.

$entity : object|null = null

The entity to load the data into. If not specified, a new entity is created.

$assoc : array<string|int, mixed>|null = null

The association that connects the entity to load to another entity, if any.

$hints : array<string|int, mixed> = []

Hints for entity creation.

$lockMode : int|null = null

One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for loading the entity.

$limit : int|null = null

Limit number of results.

$orderBy : array<string|int, string>|null = null

Criteria to order by.

Tags
psalm-param

array<string, mixed> $criteria

psalm-param

array<string, mixed>|null $assoc

psalm-param

array<string, mixed> $hints

psalm-param

array<string, string>|null $orderBy

todo

Check identity map? loadById method? Try to guess whether $criteria is the id?

Return values
object|null

The loaded and managed entity instance or NULL if the entity can not be found.

loadAll()

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

public loadAll([array<string|int, mixed> $criteria = [] ][, array<string|int, mixed>|null $orderBy = null ][, int|null $limit = null ][, int|null $offset = null ]) : mixed
Parameters
$criteria : array<string|int, mixed> = []
$orderBy : array<string|int, mixed>|null = null
$limit : int|null = null
$offset : int|null = null
Tags
psalm-param

array<string, string>|null $orderBy

psalm-param

array<string, mixed> $criteria

Return values
mixed

loadById()

Loads an entity by identifier.

public loadById(array<string|int, mixed> $identifier[, object|null $entity = null ]) : object|null
Parameters
$identifier : array<string|int, mixed>
$entity : object|null = null

The entity to load the data into. If not specified, a new entity is created.

Tags
psalm-param

array<string, mixed> $identifier The entity identifier.

todo

Check parameters

Return values
object|null

The loaded and managed entity instance or NULL if the entity can not be found.

loadCriteria()

Loads Entities matching the given Criteria object.

public loadCriteria(Criteria $criteria) : array<string|int, mixed>
Parameters
$criteria : Criteria
Return values
array<string|int, mixed>

loadManyToManyCollection()

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

public loadManyToManyCollection(array<string|int, mixed> $assoc, object $sourceEntity, PersistentCollection $collection) : array<string|int, mixed>
Parameters
$assoc : array<string|int, mixed>
$sourceEntity : object

The entity that owns the collection.

$collection : PersistentCollection

The collection to fill.

Tags
psalm-param

array<string, mixed> $assoc The association mapping of the association being loaded.

Return values
array<string|int, mixed>

loadOneToManyCollection()

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

public loadOneToManyCollection(array<string|int, mixed> $assoc, object $sourceEntity, PersistentCollection $collection) : mixed
Parameters
$assoc : array<string|int, mixed>
$sourceEntity : object
$collection : PersistentCollection

The collection to load/fill.

Tags
psalm-param

array<string, mixed> $assoc

Return values
mixed

loadOneToOneEntity()

Loads an entity of this persister's mapped class as part of a single-valued association from another entity.

public loadOneToOneEntity(array<string|int, mixed> $assoc, object $sourceEntity[, array<string|int, mixed> $identifier = [] ]) : object
Parameters
$assoc : array<string|int, mixed>
$sourceEntity : object

The entity that owns the association (not necessarily the "owning side").

$identifier : array<string|int, mixed> = []
Tags
psalm-param

array<string, mixed> $identifier The identifier of the entity to load. Must be provided if the association to load represents the owning side, otherwise the identifier is derived from the $sourceEntity.

psalm-param

array<string, mixed> $assoc The association to load.

throws
MappingException
Return values
object

The loaded and managed entity instance or NULL if the entity can not be found.

lock()

Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.

public lock(array<string|int, mixed> $criteria, int $lockMode) : void
Parameters
$criteria : array<string|int, mixed>
$lockMode : int

One of the Doctrine\DBAL\LockMode::* constants.

Tags
psalm-param

array<string, mixed> $criteria

Return values
void

refresh()

Refreshes a managed entity.

public refresh(array<string|int, mixed> $id, object $entity[, int|null $lockMode = null ]) : void
Parameters
$id : array<string|int, mixed>
$entity : object

The entity to refresh.

$lockMode : int|null = null

One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for refreshing the managed entity.

Tags
psalm-param

array<string, mixed> $id The identifier of the entity as an associative array from column or field names to values.

Return values
void

update()

Updates a managed entity. The entity is updated according to its current changeset in the running UnitOfWork. If there is no changeset, nothing is updated.

public update(object $entity) : void
Parameters
$entity : object

The entity to update.

Return values
void

Search results