Skip to content

Commit

Permalink
Rename getEagerLoaded to isEagerLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hoffmann committed Apr 17, 2017
1 parent d3c0063 commit c5d35ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Datasource/QueryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function cache($key, $config = 'default')
*
* @return bool
*/
public function getEagerLoaded()
public function isEagerLoaded()
{
return $this->_eagerLoaded;
}
Expand All @@ -194,7 +194,7 @@ public function getEagerLoaded()
* Sets the query instance to be an eager loaded query. If no argument is
* passed, the current configured query `_eagerLoaded` value is returned.
*
* @deprecated 3.5.0 Use getEagerLoaded() for the getter part instead.
* @deprecated 3.5.0 Use isEagerLoaded() for the getter part instead.
* @param bool|null $value Whether or not to eager load.
* @return $this|\Cake\ORM\Query
*/
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ public function triggerBeforeFind()
$table->dispatchEvent('Model.beforeFind', [
$this,
new ArrayObject($this->_options),
!$this->getEagerLoaded()
!$this->isEagerLoaded()
]);
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/ORM/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2527,21 +2527,21 @@ public function testEagerLoaded()
}

/**
* Tests that the getEagerLoaded function works and is transmitted correctly to eagerly
* Tests that the isEagerLoaded function works and is transmitted correctly to eagerly
* loaded associations
*
* @return void
*/
public function testGetEagerLoaded()
public function testIsEagerLoaded()
{
$table = TableRegistry::get('authors');
$table->hasMany('articles');
$query = $table->find()->contain(['articles' => function ($q) {
$this->assertTrue($q->getEagerLoaded());
$this->assertTrue($q->isEagerLoaded());

return $q;
}]);
$this->assertFalse($query->getEagerLoaded());
$this->assertFalse($query->isEagerLoaded());

$table->eventManager()->attach(function ($e, $q, $o, $primary) {
$this->assertTrue($primary);
Expand Down

0 comments on commit c5d35ee

Please sign in to comment.