generated from Nodarx/template
feat: implement message create and update
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ namespace KTXM\ProviderImap\Providers;
|
||||
|
||||
use KTXM\ProviderImap\Client\Message;
|
||||
use KTXF\Mail\Entity\EntityMutableAbstract;
|
||||
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* Mail Entity Resource Implementation
|
||||
@@ -42,6 +43,26 @@ class EntityResource extends EntityMutableAbstract {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate an entity returned by a create or replacement operation.
|
||||
*/
|
||||
public function fromMutation(
|
||||
string $mailbox,
|
||||
string|int $identifier,
|
||||
MessagePropertiesMutableInterface $properties,
|
||||
): static {
|
||||
$this->data['collection'] = $mailbox;
|
||||
$this->data['identifier'] = $identifier;
|
||||
|
||||
if ($properties instanceof MessageProperties) {
|
||||
$this->setProperties($properties);
|
||||
} else {
|
||||
$this->getProperties()->jsonDeserialize($properties->jsonSerialize());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user