Skip to content

Commit

Permalink
Retrieve correct versions for entity
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPenkov committed Mar 24, 2016
1 parent 63006b1 commit fa92c18
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 fa92c18

Please sign in to comment.