@@ -386,6 +386,11 @@ protected function _options(array $options) {
386
386
* - type: The type of join to be used (e.g. INNER)
387
387
* - matching: Indicates whether the query records should be filtered based on
388
388
* 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
389
394
*
390
395
* @param Query $query the query to be altered to include the target table data
391
396
* @param array $options Any extra options or overrides to be taken in account
@@ -492,6 +497,15 @@ protected function _dispatchBeforeFind($query) {
492
497
$ table ->getEventManager ()->dispatch ($ event );
493
498
}
494
499
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
+ */
495
509
protected function _appendFields ($ query , $ surrogate , $ options ) {
496
510
$ options ['fields ' ] = $ surrogate ->clause ('select ' ) ?: $ options ['fields ' ];
497
511
$ target = $ this ->_targetTable ;
@@ -507,6 +521,19 @@ protected function _appendFields($query, $surrogate, $options) {
507
521
}
508
522
}
509
523
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
+ */
510
537
protected function _formatAssociationResults ($ query , $ surrogate , $ options ) {
511
538
$ formatters = $ surrogate ->formatResults ();
512
539
@@ -524,6 +551,20 @@ protected function _formatAssociationResults($query, $surrogate, $options) {
524
551
}, Query::PREPEND );
525
552
}
526
553
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
+ */
527
568
protected function _bindNewAssociations ($ query , $ surrogate , $ options ) {
528
569
$ contain = $ surrogate ->contain ();
529
570
$ target = $ this ->_targetTable ;
0 commit comments