generated from Nodarx/template
feat: implement entity mutable interface
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -59,8 +59,6 @@ class RemoteMailService
|
||||
|
||||
public function __construct(
|
||||
private readonly Client $client,
|
||||
private readonly string $provider,
|
||||
private readonly string|int $service,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -330,6 +328,31 @@ class RemoteMailService
|
||||
return array_fill_keys($uids, true);
|
||||
}
|
||||
|
||||
public function entityPatch(string $collection, array $flagsToAdd = [], array $flagsToRemove = [], int ...$uids): void
|
||||
{
|
||||
if (empty($uids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->client->perform(new SelectCommand($collection, false));
|
||||
|
||||
if (!empty($flagsToAdd)) {
|
||||
$this->client->perform(new StoreCommand(
|
||||
FetchTarget::uid(SequenceSet::items(...array_values($uids))),
|
||||
$flagsToAdd,
|
||||
'+',
|
||||
));
|
||||
}
|
||||
|
||||
if (!empty($flagsToRemove)) {
|
||||
$this->client->perform(new StoreCommand(
|
||||
FetchTarget::uid(SequenceSet::items(...array_values($uids))),
|
||||
$flagsToRemove,
|
||||
'-',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function entityMove(string $targetCollection, string $sourceCollection, int ...$uids): array
|
||||
{
|
||||
if (empty($uids)) {
|
||||
|
||||
Reference in New Issue
Block a user