\Cake\ORMLazyEagerLoader

Contains methods that are capable of injecting eagerly loaded associations into entities or lists of entities by using the same syntax as the EagerLoader.

Summary

Methods
Properties
Constants
loadInto()
No public properties found
No constants found
_getQuery()
_getPropertyMap()
_injectResults()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

loadInto()

loadInto(\Cake\Datasource\EntityInterface|array  $entities, array  $contain, \Cake\ORM\Table  $source) : \Cake\Datasource\EntityInterface|array

Loads the specified associations in the passed entity or list of entities by executing extra queries in the database and merging the results in the appropriate properties.

The properties for the associations to be loaded will be overwritten on each entity.

Parameters

\Cake\Datasource\EntityInterface|array $entities

a single entity or list of entities

array $contain

A contain() compatible array.

\Cake\ORM\Table $source

The table to use for fetching the top level entities

Returns

\Cake\Datasource\EntityInterface|array

_getQuery()

_getQuery(\Cake\Collection\CollectionInterface  $objects, array  $contain, \Cake\ORM\Table  $source) : \Cake\ORM\Query

Builds a query for loading the passed list of entity objects along with the associations specified in $contain.

Parameters

\Cake\Collection\CollectionInterface $objects

The original entities

array $contain

The associations to be loaded

\Cake\ORM\Table $source

The table to use for fetching the top level entities

Returns

\Cake\ORM\Query

_getPropertyMap()

_getPropertyMap(\Cake\ORM\Table  $source, array<mixed,string>  $associations) : array

Returns a map of property names where the association results should be injected in the top level entities.

Parameters

\Cake\ORM\Table $source

The table having the top level associations

array<mixed,string> $associations

The name of the top level associations

Returns

array

_injectResults()

_injectResults(array<mixed,\Cake\Datasource\EntityInterface>|\Traversable  $objects, \Cake\Collection\CollectionInterface|\Cake\Database\Query  $results, array<mixed,string>  $associations, \Cake\ORM\Table  $source) : array

Injects the results of the eager loader query into the original list of entities.

Parameters

array<mixed,\Cake\Datasource\EntityInterface>|\Traversable $objects

The original list of entities

\Cake\Collection\CollectionInterface|\Cake\Database\Query $results

The loaded results

array<mixed,string> $associations

The top level associations that were loaded

\Cake\ORM\Table $source

The table where the entities came from

Returns

array