refactor: chrono entity classes
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -9,14 +9,28 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Chrono\Entity;
|
||||
|
||||
use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements EntityPropertiesBaseInterface {
|
||||
/**
|
||||
* Common base of the typed chrono entity objects ({@see EventObject},
|
||||
* {@see TaskObject}, {@see JournalObject}).
|
||||
*
|
||||
* Gives providers a single class to build or extend entity properties
|
||||
* against without involving the entity node wrapper, and one home for the
|
||||
* shared behavior: the type/schema markers and the JSON serialization /
|
||||
* deserialization machinery inherited from JsonSerializableObject.
|
||||
*/
|
||||
abstract class EntityPropertiesBaseAbstract extends JsonSerializableObject implements EntityPropertiesBaseInterface {
|
||||
|
||||
public string $type = 'event';
|
||||
public int $schema = 1;
|
||||
|
||||
public function type(): string {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function schema(): int {
|
||||
return $this->schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getDataRaw(): array|string|null {
|
||||
return $this->data[self::PROPERTY_DATA] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user