feat: entity patch

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-20 23:51:40 -04:00
parent 49712b5f87
commit 55dcd8a3f1
2 changed files with 34 additions and 1 deletions

View File

@@ -91,6 +91,7 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
self::CAPABILITY_ENTITY_FETCH => true,
self::CAPABILITY_ENTITY_CREATE => false,
self::CAPABILITY_ENTITY_MODIFY => false,
self::CAPABILITY_ENTITY_PATCH => true,
self::CAPABILITY_ENTITY_DELETE => true,
self::CAPABILITY_ENTITY_MOVE => true,
self::CAPABILITY_ENTITY_COPY => false,
@@ -631,8 +632,18 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
foreach ($targets as $targetCollection => $targetIdentifiers) {
$uids = array_keys($targetIdentifiers);
$flagsAdd = [];
$flagsRemove = [];
$mutations = $this->mailService->entityPatch($targetCollection, $properties, ...$uids);
foreach ($properties->getFlags() as $flag => $value) {
if ($value === true) {
$flagsAdd[] = $flag;
} elseif ($value === false) {
$flagsRemove[] = $flag;
}
}
$mutations = $this->mailService->entityPatch($targetCollection, $flagsAdd, $flagsRemove, ...$uids);
foreach ($uids as $uid) {
$list[(string)$targetIdentifiers[$uid]] = ['disposition' => 'patched'];