\Cake\ORMEagerLoadable

Represents a single level in the associations tree to be eagerly loaded for a specific query. This contains all the information required to fetch the results from the database from an associations and all its children levels.

Summary

Methods
Properties
Constants
__construct()
addAssociation()
associations()
instance()
aliasPath()
propertyPath()
setCanBeJoined()
canBeJoined()
setConfig()
getConfig()
config()
forMatching()
targetProperty()
asContainArray()
No public properties found
No constants found
No protected methods found
$_name
$_associations
$_instance
$_config
$_aliasPath
$_propertyPath
$_canBeJoined
$_forMatching
$_targetProperty
N/A
No private methods found
No private properties found
N/A

Properties

$_name

$_name : string

The name of the association to load.

Type

string

$_associations

$_associations : array<mixed,\Cake\ORM\EagerLoadable>

A list of other associations to load from this level.

Type

array<mixed,\Cake\ORM\EagerLoadable>

$_instance

$_instance : \Cake\ORM\Association

The Association class instance to use for loading the records.

Type

\Cake\ORM\Association

$_config

$_config : array

A list of options to pass to the association object for loading the records.

Type

array

$_aliasPath

$_aliasPath : string

A dotted separated string representing the path of associations that should be followed to fetch this level.

Type

string

$_propertyPath

$_propertyPath : string

A dotted separated string representing the path of entity properties in which results for this level should be placed.

For example, in the following nested property:

 $article->author->company->country

The property path of country will be author.company

Type

string

$_canBeJoined

$_canBeJoined : boolean

Whether or not this level can be fetched using a join.

Type

boolean

$_forMatching

$_forMatching : boolean

Whether or not this level was meant for a "matching" fetch operation

Type

boolean

$_targetProperty

$_targetProperty : string

The property name where the association result should be nested in the result.

For example, in the following nested property:

 $article->author->company->country

The target property of country will be just country

Type

string

Methods

__construct()

__construct(string  $name, array  $config = array()) 

Constructor. The $config parameter accepts the following array keys:

  • associations
  • instance
  • config
  • canBeJoined
  • aliasPath
  • propertyPath
  • forMatching
  • targetProperty

The keys maps to the settable properties in this class.

Parameters

string $name

The Association name.

array $config

The list of properties to set.

addAssociation()

addAssociation(string  $name, \Cake\ORM\EagerLoadable  $association) : void

Adds a new association to be loaded from this level.

Parameters

string $name

The association name.

\Cake\ORM\EagerLoadable $association

The association to load.

associations()

associations() : array

Returns the Association class instance to use for loading the records.

Returns

array

instance()

instance() : \Cake\ORM\Association|null

Gets the Association class instance to use for loading the records.

Returns

\Cake\ORM\Association|null

aliasPath()

aliasPath() : string|null

Gets a dot separated string representing the path of associations that should be followed to fetch this level.

Returns

string|null

propertyPath()

propertyPath() : string|null

Gets a dot separated string representing the path of entity properties in which results for this level should be placed.

For example, in the following nested property:

 $article->author->company->country

The property path of country will be author.company

Returns

string|null

setCanBeJoined()

setCanBeJoined(boolean  $possible) : $this

Sets whether or not this level can be fetched using a join.

Parameters

boolean $possible

The value to set.

Returns

$this

canBeJoined()

canBeJoined(boolean|null  $possible = null) : boolean

Gets whether or not this level can be fetched using a join.

If called with arguments it sets the value. As of 3.4.0 the setter part is deprecated, use setCanBeJoined() instead.

Parameters

boolean|null $possible

The value to set.

Returns

boolean

setConfig()

setConfig(array  $config) : $this

Sets the list of options to pass to the association object for loading the records.

Parameters

array $config

The value to set.

Returns

$this

getConfig()

getConfig() : array

Gets the list of options to pass to the association object for loading the records.

Returns

array

config()

config(array|null  $config = null) : array

Sets the list of options to pass to the association object for loading the records.

If called with no arguments it returns the current value.

Parameters

array|null $config

The value to set.

Returns

array

forMatching()

forMatching() : boolean|null

Gets whether or not this level was meant for a "matching" fetch operation.

Returns

boolean|null

targetProperty()

targetProperty() : string|null

The property name where the result of this association should be nested at the end.

For example, in the following nested property:

 $article->author->company->country

The target property of country will be just country

Returns

string|null

asContainArray()

asContainArray() : array

Returns a representation of this object that can be passed to Cake\ORM\EagerLoader::contain()

Returns

array