Skip to content

Commit 4bf5f10

Browse files
committed
More marshaller tests fixed
1 parent eaa62ee commit 4bf5f10

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ORM/Marshaller.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
256256

257257
if (isset($propertyMap[$key])) {
258258
$assoc = $propertyMap[$key]['association'];
259-
$nested = $propertyMap[$key]['nested'];
259+
$nested = ['associated' => $propertyMap[$key]['nested']];
260260
$value = $this->_mergeAssociation($original, $assoc, $value, $nested);
261261
} elseif ($columnType) {
262262
$converter = Type::build($columnType);
@@ -363,14 +363,15 @@ protected function _mergeAssociation($original, $assoc, $value, $options) {
363363
*/
364364
protected function _mergeBelongsToMany($original, $assoc, $value, $options) {
365365
$hasIds = array_key_exists('_ids', $value);
366+
$associated = isset($options['associated']) ? $options['associated'] : [];
366367
if ($hasIds && is_array($value['_ids'])) {
367368
return $this->_loadBelongsToMany($assoc, $value['_ids']);
368369
}
369370
if ($hasIds) {
370371
return [];
371372
}
372373

373-
if (!in_array('_joinData', $options) && !isset($options['_joinData'])) {
374+
if (!in_array('_joinData', $associated) && !isset($associated['_joinData'])) {
374375
return $this->mergeMany($original, $value, $options);
375376
}
376377

@@ -386,8 +387,8 @@ protected function _mergeBelongsToMany($original, $assoc, $value, $options) {
386387
$marshaller = $joint->marshaller();
387388

388389
$nested = [];
389-
if (isset($options['_joinData']['associated'])) {
390-
$nested = (array)$options['_joinData']['associated'];
390+
if (isset($associated['_joinData']['associated'])) {
391+
$nested = ['associated' => (array)$associated['_joinData']['associated']];
391392
}
392393

393394
$records = $this->mergeMany($original, $value, $options);

0 commit comments

Comments
 (0)