Skip to content

Commit

Permalink
Fix additional data coming from right table.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Mar 26, 2017
1 parent 3c69b8e commit d1022ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Model/Behavior/VersionBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,15 @@ public function groupVersions($results)
$versionData = [
$versionField => $versionId
];

/* @var \Cake\Datasource\EntityInterface $versionRow */
$versionRow = $grouped->match(['version_id' => $versionId])->first();

foreach ($this->_config['additionalVersionFields'] as $mappedField => $field) {
if (!is_string($mappedField)) {
$mappedField = 'version_' . $field;
}
$versionData[$mappedField] = $row->get($field);
$versionData[$mappedField] = $versionRow->get($field);
}

$version = new $entityClass($keys + $versionData, [
Expand Down

0 comments on commit d1022ad

Please sign in to comment.