Skip to content

Commit dda6dfb

Browse files
authored
Merge pull request #6 from grokability/improve_collection_updates_azure
add new setReplace method to handle Azure PATCH operations better
2 parents d406a72 + 402ad1f commit dda6dfb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Attribute/Collection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ function ($value, &$object) use ($key, $parent) {
9494
$o[$key]->add($value, $object);
9595
}
9696
}
97+
)->setReplace(
98+
function ($value, &$object) use ($key, $parent) {
99+
$collection = Collection::filterCollection($parent->filter, collect($parent->collection), $object);
100+
101+
$result = [];
102+
103+
foreach ($collection as $o) {
104+
$o[$key]->add($value, $object);
105+
}
106+
}
97107
)->setRead(
98108
function (&$object) use ($key, $parent) {
99109
$collection = Collection::filterCollection($parent->filter, collect($parent->collection), $object);

0 commit comments

Comments
 (0)