Skip to content

Commit

Permalink
Merge 3a03377 into a39f97f
Browse files Browse the repository at this point in the history
  • Loading branch information
Spriz committed Jul 17, 2019
2 parents a39f97f + 3a03377 commit a8e2c13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Model/Behavior/VersionBehavior.php
Expand Up @@ -234,6 +234,11 @@ public function afterSave(Event $event, EntityInterface $entity)
*/
public function getVersionId(EntityInterface $entity)
{
$versionField = $this->_config['versionField'];
if (!empty($versionField) && in_array($versionField, $this->_table->getSchema()->columns())) {
return $entity->get($this->_config['versionField']);
}

$table = TableRegistry::get($this->_config['versionTable']);
$preexistent = $table->find()
->select(['version_id'])
Expand Down

0 comments on commit a8e2c13

Please sign in to comment.