Skip to content

Commit ed11b09

Browse files
committed
Update Query::$primary and Query::primary() names.
To Query::eagerLoaded and Query::eagerLoaded(), respectively. To reflect the real purpose of the variable/function.
1 parent d1c67fe commit ed11b09

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Datasource/QueryTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function all() {
185185
}
186186

187187
$table = $this->repository();
188-
$event = new Event('Model.beforeFind', $table, [$this, $this->_options, $this->primary()]);
188+
$event = new Event('Model.beforeFind', $table, [$this, $this->_options, $this->eagerLoaded()]);
189189
$table->getEventManager()->dispatch($event);
190190

191191
if (isset($this->_results)) {

src/ORM/Association.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public function attachTo(Query $query, array $options = []) {
418418
}
419419

420420
$options['conditions'] = $query->newExpr()->add($options['conditions']);
421-
$dummy = $target->query()->primary(false);
421+
$dummy = $target->query()->eagerLoaded(false);
422422

423423
if (!empty($options['queryBuilder'])) {
424424
$dummy = $options['queryBuilder']($dummy);

src/ORM/Association/ExternalAssociationTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ protected function _buildQuery($options) {
228228
$fetchQuery = $this
229229
->find('all')
230230
->where($options['conditions'])
231-
->primary(false)
231+
->eagerLoaded(false)
232232
->hydrate($options['query']->hydrate());
233233
$fetchQuery = $this->_addFilteringCondition($fetchQuery, $key, $filter);
234234

src/ORM/Query.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Query extends DatabaseQuery {
100100
*
101101
* @var boolean
102102
*/
103-
protected $_primary = true;
103+
protected $_eagerLoaded = true;
104104

105105
/**
106106
* Constuctor
@@ -654,17 +654,17 @@ protected function _dirty() {
654654
}
655655

656656
/**
657-
* Sets the query instance to be the primary query. If no argument is passed,
658-
* the current configured query `_primary` value is returned.
657+
* Sets the query instance to be the eager loaded query. If no argument is
658+
* passed, the current configured query `_eagerLoaded` value is returned.
659659
*
660660
* @param boolean $value
661661
* @return \Cake\ORM\Query
662662
*/
663-
public function primary($value = null) {
663+
public function eagerLoaded($value = null) {
664664
if ($value === null) {
665-
return $this->_primary;
665+
return $this->_eagerLoaded;
666666
}
667-
$this->_primary = $value;
667+
$this->_eagerLoaded = $value;
668668
return $this;
669669
}
670670

src/ORM/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
* Table objects provide a few callbacks/events you can hook into to augment/replace
7474
* find operations. Each event uses the standard event subsystem in CakePHP
7575
*
76-
* - `beforeFind($event, $query, $options, $primary)` - Fired before each find operation.
76+
* - `beforeFind($event, $query, $options, $eagerLoaded)` - Fired before each find operation.
7777
* By stopping the event and supplying a return value you can bypass the find operation
7878
* entirely. Any changes done to the $query instance will be retained for the rest of the find.
7979
* - `beforeValidate($event, $entity, $options, $validator)` - Fired before an entity is validated.

0 commit comments

Comments
 (0)