crudle / entity
A set of Entity assistance components
v1.0
2016-10-24 18:26 UTC
Requires
- php: >=7.0
- ramsey/uuid: ^3.5
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is not auto-updated.
Last update: 2025-04-26 22:56:18 UTC
README
This package contains various things like traits for private immutable attributes, and making entities identifiable with UUID's.
Installation
composer require crudle/entity
Example Usage
use Crudle\Entity\Identity\IdentifiedByUuid; use Crudle\Entity\Property\PrivateImmutableAttributes; class MyEntity { use IdentifiedByUuid, PrivateImmutableAttributes; /** * @param string $description * @return MyEntity */ public function setDescription(string $description): MyEntity { return $this->set('description', $description); } /** * @return string * @throws \Crudle\Entity\Exception\UndefinedException * When a description has not yet been set */ public function getDescription(): string { return $this->getOrFail('description'); } } $myEntity = new MyEntity; $myEntity->getId(); // Crudle\Entity\Identity\Uuid $myOtherEntity = new MyEntity('fa8588c6-166d-400d-9b13-561704027e94');