CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.10 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.10
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
      • Association
      • Behavior
      • Exception
      • Locator
      • Rule
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class EagerLoadable

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.

Namespace: Cake\ORM

Property Summary

  • $_aliasPath protected
    string

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

  • $_associations protected
    Cake\ORM\EagerLoadable[]

    A list of other associations to load from this level.

  • $_canBeJoined protected
    bool

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

  • $_config protected
    array

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

  • $_forMatching protected
    bool

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

  • $_instance protected
    Cake\ORM\Association

    The Association class instance to use for loading the records.

  • $_name protected
    string

    The name of the association to load.

  • $_propertyPath protected
    string

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

  • $_targetProperty protected
    string

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

Method Summary

  • __construct() public

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

  • addAssociation() public

    Adds a new association to be loaded from this level.

  • aliasPath() public

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

  • asContainArray() public

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

  • associations() public

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

  • canBeJoined() public

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

  • config() public deprecated

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

  • forMatching() public

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

  • getConfig() public

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

  • instance() public

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

  • propertyPath() public

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

  • setCanBeJoined() public

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

  • setConfig() public

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

  • targetProperty() public

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

Method Detail

__construct() ¶ public

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

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 optional

The list of properties to set.

addAssociation() ¶ public

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.

Returns
void

aliasPath() ¶ public

aliasPath(): string|null

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

Returns
string|null

asContainArray() ¶ public

asContainArray(): array

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

Returns
array

associations() ¶ public

associations(): array

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

Returns
array

canBeJoined() ¶ public

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

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
bool|null $possible optional

The value to set.

Returns
bool

config() ¶ public

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 optional

The value to set.

Returns
array

forMatching() ¶ public

forMatching(): bool|null

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

Returns
bool|null

getConfig() ¶ public

getConfig(): array

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

Returns
array

instance() ¶ public

instance(): Cake\ORM\Association|null

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

Returns
Cake\ORM\Association|null

propertyPath() ¶ public

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() ¶ public

setCanBeJoined(bool $possible): $this

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

Parameters
bool $possible

The value to set.

Returns
$this

setConfig() ¶ public

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

targetProperty() ¶ public

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

Property Detail

$_aliasPath ¶ protected

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

Type
string

$_associations ¶ protected

A list of other associations to load from this level.

Type
Cake\ORM\EagerLoadable[]

$_canBeJoined ¶ protected

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

Type
bool

$_config ¶ protected

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

Type
array

$_forMatching ¶ protected

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

Type
bool

$_instance ¶ protected

The Association class instance to use for loading the records.

Type
Cake\ORM\Association

$_name ¶ protected

The name of the association to load.

Type
string

$_propertyPath ¶ protected

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

$_targetProperty ¶ protected

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
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs