Represents a type of association that that needs to be recovered by performing an extra query.
$_sort
protected mixed
Sets the name of the field representing the foreign key to the source table. If no parameters are passed current field is returned
Sets the sort order in which target records should be returned. If no arguments are passed the currently configured value is returned
_buildResultMap( $fetchQuery , $options )
_defaultOptions( )
Returns the default options to use for the eagerLoader
_options( array $opts )
Parse extra options passed in the constructor.
$opts
canBeJoined( array $options [] )
Whether this association can be expressed directly in a query join
$options
optional [] if the 'matching' key in $option is true then this function will return true, false otherwise
defaultRowValue( $row , $joined )
foreignKey( string|null $key null )
Sets the name of the field representing the foreign key to the source table. If no parameters are passed current field is returned
$key
optional null sort( mixed $sort null )
Sets the sort order in which target records should be returned. If no arguments are passed the currently configured value is returned
$sort
optional null _addFilteringCondition( Cake\ORM\Query $query , string|array $key , mixed $filter )
Appends any conditions required to load the relevant set of records in the target table query given a filter key and some filtering values.
Cake\ORM\Query
$query
$key
$filter
Cake\ORM\Query
_addFilteringJoin( Cake\ORM\Query $query , string $key , Cake\ORM\Query $subquery )
Appends any conditions required to load the relevant set of records in the target table query given a filter key and some filtering values when the filtering needs to be done using a subquery.
Cake\ORM\Query
$query
$key
Cake\ORM\Query
$subquery
Cake\ORM\Query
_assertFieldsPresent( Cake\ORM\Query $fetchQuery , array $key )
Checks that the fetching query either has auto fields on or has the foreignKey fields selected. If the required fields are missing, throws an exception.
Cake\ORM\Query
$fetchQuery
$key
_buildQuery( array $options )
Auxiliary function to construct a new Query object to return all the records in the target table that are associated to those specified in $options from the source table
$options
Cake\ORM\Query
_buildSubquery( Cake\ORM\Query $query )
Builds a query to be used as a condition for filtering records in the target table, it is constructed by cloning the original query that was used to load records in the source table.
Cake\ORM\Query
$query
Cake\ORM\Query
_createTupleCondition( Cake\ORM\Query $query , array $keys , mixed $filter , string $operator )
Returns a TupleComparison object that can be used for matching all the fields from $keys with the tuple values in $filter using the provided operator.
Cake\ORM\Query
$query
$keys
$filter
$operator
_linkField( array $options )
Generates a string used as a table field that contains the values upon which the filter should be applied
$options
_multiKeysInjector( array $resultMap , array $sourceKeys , string $nestKey )
Returns a callable to be used for each row in a query result set for injecting the eager loaded rows when the matching needs to be done with multiple foreign keys
$resultMap
$sourceKeys
$nestKey
_resultInjector( Cake\ORM\Query $fetchQuery , array $resultMap , array $options )
Returns a callable to be used for each row in a query result set for injecting the eager loaded rows
Cake\ORM\Query
$fetchQuery
$resultMap
an array with the foreignKey as keys and the corresponding target table results as value.
$options
_subqueryFields( Cake\ORM\Query $query )
Calculate the fields that need to participate in a subquery.
Normally this includes the binding key columns. If there is a an ORDER BY, those columns are also included as the fields may be calculated or constant values, that need to be present to ensure the correct association data is loaded.
Cake\ORM\Query
$query
eagerLoader( array $options )
requiresKeys( array $options [] )
Returns true if the eager loading process will require a set of the owning table's binding keys in order to use them as a filter in the finder query.
$options
optional []
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.3/class-Cake.ORM.Association.ExternalAssociationTrait.html