diff --git a/src/Model/Behavior/Version/VersionTrait.php b/src/Model/Behavior/Version/VersionTrait.php index e6420a5..10c1785 100644 --- a/src/Model/Behavior/Version/VersionTrait.php +++ b/src/Model/Behavior/Version/VersionTrait.php @@ -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)) {