Skip to content

Commit 689f689

Browse files
committed
Adding doc blocks
1 parent 9e6aa7e commit 689f689

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/ORM/Association.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ protected function _options(array $options) {
386386
* - type: The type of join to be used (e.g. INNER)
387387
* - matching: Indicates whether the query records should be filtered based on
388388
* the records found on this association. This will force a 'INNER JOIN'
389+
* - aliasPath: A dot separated string representing the path of association names
390+
* followed from the passed query main table to this association.
391+
* - propertyPath: A dot separated string representing the path of association
392+
* properties to be followed from the passed query main entity to this
393+
* association
389394
*
390395
* @param Query $query the query to be altered to include the target table data
391396
* @param array $options Any extra options or overrides to be taken in account
@@ -492,6 +497,15 @@ protected function _dispatchBeforeFind($query) {
492497
$table->getEventManager()->dispatch($event);
493498
}
494499

500+
/**
501+
* Helper function used to conditionally append fields to the select clause of
502+
* a query from the fields found in another query object.
503+
*
504+
* @param \Cake\ORM\Query $query the query that will get the fields appended to
505+
* @param \Cake\ORM\Query $surrogate the query having the fields to be copied from
506+
* @param array $options options passed to the method `attachTo`
507+
* @return void
508+
*/
495509
protected function _appendFields($query, $surrogate, $options) {
496510
$options['fields'] = $surrogate->clause('select') ?: $options['fields'];
497511
$target = $this->_targetTable;
@@ -507,6 +521,19 @@ protected function _appendFields($query, $surrogate, $options) {
507521
}
508522
}
509523

524+
/**
525+
* Adds a formatter function to the passed `$query` if the `$surrogate` query
526+
* declares any other formatter. Since the `$surrogate` query correspond to
527+
* the associated target table, the resulting formatter will be the result of
528+
* applying the surrogate formatters to only the property corresponding to
529+
* such table.
530+
*
531+
* @param \Cake\ORM\Query $query the query that will get the formatter applied to
532+
* @param \Cake\ORM\Query $surrogate the query having formatters for the associated
533+
* target table.
534+
* @param array $options options passed to the method `attachTo`
535+
* @return void
536+
*/
510537
protected function _formatAssociationResults($query, $surrogate, $options) {
511538
$formatters = $surrogate->formatResults();
512539

@@ -524,6 +551,20 @@ protected function _formatAssociationResults($query, $surrogate, $options) {
524551
}, Query::PREPEND);
525552
}
526553

554+
/**
555+
*
556+
* Applies all attachable associations to `$query` out of the containments found
557+
* in the `$surrogate` query.
558+
*
559+
* Copies all contained associations from the `$surrogate` query into the
560+
* passed `$query`. Containments are altered so that thy respect the associations
561+
* chain from which they originated.
562+
*
563+
* @param \Cake\ORM\Query $query the query that will get the associations attached to
564+
* @param \Cake\ORM\Query $surrogate the query having the containments to be attached
565+
* @param array $options options passed to the method `attachTo`
566+
* @return void
567+
*/
527568
protected function _bindNewAssociations($query, $surrogate, $options) {
528569
$contain = $surrogate->contain();
529570
$target = $this->_targetTable;

0 commit comments

Comments
 (0)