Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jul 28, 2015
1 parent eedd04c commit 58aa13d
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/RowCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __get($name)

$collection = $this->select($name)->all();

if ($this->hasOne($name)) {
if ($this->entity->hasOne($name)) {
$this->joinOne($collection);
} else {
$this->joinMany($collection);
Expand Down Expand Up @@ -402,6 +402,7 @@ public function joinMany(RowCollection $rows)

/**
* Distribute a rowcollection througth all rows.
* Its the opposite of $this->joinMany()
*
* @param RowCollection $rows
*
Expand All @@ -412,16 +413,5 @@ public function joinOne(RowCollection $rows)
$rows->joinMany($this);

return $this;


$foreignKey = $rows->getEntity()->foreignKey;

foreach ($this->rows as $row) {
$id = $row->$foreignKey;

$row->$name = $rows[$id];
}

return $this;
}
}

0 comments on commit 58aa13d

Please sign in to comment.