Skip to content

Commit

Permalink
Allow the eager loader to take an array of models as well as a collec…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
Mathew Davies committed Jul 19, 2012
1 parent b743314 commit 34659c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/TheCure/Optimisers/EagerLoader.php
Expand Up @@ -80,7 +80,7 @@ private function appendRelationAndIDs(
}

private function getRelationshipsAndIDsFromCollection(
ModelCollection $collection)
\TheCure\Collections\Collection $collection)
{
$attributes = array();
$accessor = new TransferObjectAccessor;
Expand Down Expand Up @@ -142,9 +142,15 @@ private function getRelationshipsAndIDsFromCollection(
*/
public function loadRelations(
Container $container,
ModelCollection $collection,
$collection,
array $relationNames = array())
{

if (is_array($collection))
{
$collection = new \TheCure\Collections\Collection($collection);
}

$ids = $this->getRelationshipsAndIDsFromCollection($collection);

$eagerLoaded = array();
Expand Down

0 comments on commit 34659c8

Please sign in to comment.