class SimpleObjectHydrator extends AbstractHydrator (View source)

Properties

protected ResultSetMapping $rsm The ResultSetMapping. from AbstractHydrator
protected EntityManagerInterface $em The EntityManager instance. from AbstractHydrator
protected AbstractPlatform $platform The dbms Platform instance. from AbstractHydrator
protected UnitOfWork $uow The UnitOfWork of the associated EntityManager. from AbstractHydrator
protected ClassMetadata[] $metadataCache Local ClassMetadata cache to avoid going to the EntityManager all the time. from AbstractHydrator
protected mixed[][] $cache The cache used during row-by-row hydration. from AbstractHydrator
protected Statement $stmt The statement that provides the data to hydrate. from AbstractHydrator
protected mixed[] $hints The query hints. from AbstractHydrator

Methods

__construct(EntityManagerInterface $em)

Initializes a new instance of a class derived from AbstractHydrator.

iterate(object $stmt, object $resultSetMapping, array $hints = [])

Initiates a row-by-row hydration.

mixed[]
hydrateAll(object $stmt, object $resultSetMapping, array $hints = [])

Hydrates all rows returned by the passed statement instance at once.

mixed
hydrateRow()

Hydrates a single row returned by the current statement instance during row-by-row hydration with {@link iterate()}.

onClear(mixed $eventArgs)

When executed in a hydrate() loop we have to clear internal state to decrease memory consumption.

prepare()

Executes one-time preparation tasks, once each time hydration is started through {@link hydrateAll} or {@link iterate()}.

cleanup()

Executes one-time cleanup tasks at the end of a hydration that was initiated through {@link hydrateAll} or {@link iterate()}.

hydrateRowData(array $sqlResult, array $result)

Hydrates a single row from the current statement instance.

mixed[]
hydrateAllData()

Hydrates all rows from the current statement instance at once.

mixed[]
gatherRowData(array $data, array $id, array $nonemptyComponents)

Processes a row of the result set.

mixed[]
gatherScalarRowData(mixed[] $data)

Processes a row of the result set.

mixed[]|null
hydrateColumnInfo(string $key)

Retrieve column information from ResultSetMapping.

getClassMetadata(string $className)

Retrieve ClassMetadata associated to entity class name.

Details

__construct(EntityManagerInterface $em)

Initializes a new instance of a class derived from AbstractHydrator.

Parameters

EntityManagerInterface $em The EntityManager to use.

IterableResult iterate(object $stmt, object $resultSetMapping, array $hints = [])

Initiates a row-by-row hydration.

Parameters

object $stmt
object $resultSetMapping
array $hints

Return Value

IterableResult

mixed[] hydrateAll(object $stmt, object $resultSetMapping, array $hints = [])

Hydrates all rows returned by the passed statement instance at once.

Parameters

object $stmt
object $resultSetMapping
array $hints

Return Value

mixed[]

mixed hydrateRow()

Hydrates a single row returned by the current statement instance during row-by-row hydration with {@link iterate()}.

Return Value

mixed

onClear(mixed $eventArgs)

When executed in a hydrate() loop we have to clear internal state to decrease memory consumption.

Parameters

mixed $eventArgs

protected prepare()

Executes one-time preparation tasks, once each time hydration is started through {@link hydrateAll} or {@link iterate()}.

protected cleanup()

Executes one-time cleanup tasks at the end of a hydration that was initiated through {@link hydrateAll} or {@link iterate()}.

protected hydrateRowData(array $sqlResult, array $result)

Hydrates a single row from the current statement instance.

Template method.

Parameters

array $sqlResult
array $result The result to fill.

Exceptions

HydrationException

protected mixed[] hydrateAllData()

Hydrates all rows from the current statement instance at once.

Return Value

mixed[]

protected mixed[] gatherRowData(array $data, array $id, array $nonemptyComponents)

Processes a row of the result set.

Used for identity-based hydration (HYDRATE_OBJECT and HYDRATE_ARRAY). Puts the elements of a result row into a new array, grouped by the dql alias they belong to. The column names in the result set are mapped to their field names during this procedure as well as any necessary conversions on the values applied. Scalar values are kept in a specific key 'scalars'.

Parameters

array $data SQL Result Row.
array $id Dql-Alias => ID-Hash.
array $nonemptyComponents Does this DQL-Alias has at least one non NULL value?

Return Value

mixed[] An array with all the fields (name => value) of the data row, grouped by their component alias.

protected mixed[] gatherScalarRowData(mixed[] $data)

Processes a row of the result set.

Used for HYDRATE_SCALAR. This is a variant of _gatherRowData() that simply converts column names to field names and properly converts the values according to their types. The resulting row has the same number of elements as before.

Parameters

mixed[] $data

Return Value

mixed[] The processed row.

protected mixed[]|null hydrateColumnInfo(string $key)

Retrieve column information from ResultSetMapping.

Parameters

string $key Column name

Return Value

mixed[]|null

protected ClassMetadata getClassMetadata(string $className)

Retrieve ClassMetadata associated to entity class name.

Parameters

string $className

Return Value

ClassMetadata