refactor: use unified service provider desing

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-25 23:41:26 -04:00
parent d13c3f4ac6
commit 4b4e7a3ae0
5 changed files with 282 additions and 168 deletions
+7 -7
View File
@@ -30,14 +30,14 @@ class EntityResource extends EntityMutableAbstract {
$document = (array) $document;
}
$this->data[self::JSON_PROPERTY_IDENTIFIER] = $document['eid'] ?? null;
$this->data[self::PROPERTY_IDENTIFIER] = $document['eid'] ?? null;
$this->tenantId = $document['tid'] ?? null;
$this->userId = $document['uid'] ?? null;
$this->data[self::JSON_PROPERTY_COLLECTION] = $document['cid'] ?? null;
$this->data[self::JSON_PROPERTY_CREATED] = $document['createdOn'] ?? null;
$this->data[self::JSON_PROPERTY_MODIFIED] = $document['modifiedOn'] ?? null;
$this->data[self::PROPERTY_COLLECTION] = $document['cid'] ?? null;
$this->data[self::PROPERTY_CREATED] = $document['createdOn'] ?? null;
$this->data[self::PROPERTY_MODIFIED] = $document['modifiedOn'] ?? null;
$this->getProperties()->fromStore($document);
$this->data[self::JSON_PROPERTY_SIGNATURE] = md5(json_encode($this->getDataJson()));
$this->data[self::PROPERTY_SIGNATURE] = md5(json_encode($this->getDataJson()));
$this->entityDataObject = null;
return $this;
@@ -49,7 +49,7 @@ class EntityResource extends EntityMutableAbstract {
'uid' => $this->userId,
'cid' => $this->collection(),
'eid' => $this->identifier(),
'createdOn' => $this->data[self::JSON_PROPERTY_CREATED] ?? date('c'),
'createdOn' => $this->data[self::PROPERTY_CREATED] ?? date('c'),
'modifiedOn' => date('c'),
], static fn($value) => $value !== null);
@@ -85,7 +85,7 @@ class EntityResource extends EntityMutableAbstract {
{
$this->entityDataObject = null;
$this->getProperties()->setDataRaw($value);
$this->data[self::JSON_PROPERTY_SIGNATURE] = md5(json_encode($value));
$this->data[self::PROPERTY_SIGNATURE] = md5(json_encode($value));
return $this;
}