Skip to content

Commit

Permalink
Making target alias more extensible
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Conroy committed Jun 24, 2015
1 parent 44fbc41 commit 2238303
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ORM/Marshaller.php
Expand Up @@ -287,6 +287,7 @@ protected function _belongsToMany(Association $assoc, array $data, $options = []
$records = [];
$conditions = [];
$primaryCount = count($primaryKey);
$target = $assoc->target();

foreach ($data as $i => $row) {
if (!is_array($row)) {
Expand All @@ -296,7 +297,7 @@ protected function _belongsToMany(Association $assoc, array $data, $options = []
$keys = array_intersect_key($row, $primaryKey);
if (count($keys) === $primaryCount) {
foreach ($keys as $key => $value) {
$conditions[][$assoc->alias() . '.' . $key] = $value;
$conditions[][$target->aliasfield($key)] = $value;
}
}
} else {
Expand Down

0 comments on commit 2238303

Please sign in to comment.