Skip to content

Commit 525fc69

Browse files
authored
Merge pull request #250 from cakephp/3.x-composer
Add Composer constraint for CakePHP
2 parents 2497b24 + 0b20c28 commit 525fc69

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"source": "https://github.com/cakephp/elastic-search"
1919
},
2020
"require": {
21+
"cakephp/cakephp": "^4.0",
2122
"ruflin/elastica": "^6.0"
2223
},
2324
"require-dev": {
24-
"cakephp/cakephp": "^4.0",
2525
"cakephp/cakephp-codesniffer": "^4.0",
2626
"phpunit/phpunit": "^8.5"
2727
},

src/Marshaller.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,16 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
293293
public function mergeMany(array $entities, array $data, array $options = [])
294294
{
295295
$indexed = (new Collection($data))
296-
->groupBy('id')
296+
->groupBy(function ($element) {
297+
return $element['id'] ?? '';
298+
})
297299
->map(function ($element, $key) {
298300
return $key === '' ? $element : $element[0];
299301
})
300302
->toArray();
301303

302-
$new = $indexed[null] ?? [];
303-
unset($indexed[null]);
304+
$new = $indexed[''] ?? [];
305+
unset($indexed['']);
304306

305307
$output = [];
306308
foreach ($entities as $record) {

0 commit comments

Comments
 (0)