Skip to content

Commit

Permalink
Merge pull request #11 from DanielPenkov/master
Browse files Browse the repository at this point in the history
Retrieve correct versions for entity
  • Loading branch information
josegonzalez committed Mar 24, 2016
2 parents 63006b1 + fa92c18 commit 60b817f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Model/Behavior/Version/VersionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ public function versions($reset = false)
return $this->get('_versions');
}

$conditions = ['primaryKey' => $this->id];

$table = TableRegistry::get($this->source());
$entities = $table->find('versions', $conditions)
$primaryKey = $table->primaryKey();

$conditions = [$primaryKey => $this->id];
$entities = $table->find('versions', ['conditions' => $conditions])
->all();

if (empty($entities)) {
Expand Down

0 comments on commit 60b817f

Please sign in to comment.