arthem / object-reference-bundle
Object reference bundle
Installs: 259
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^8.2
- doctrine/orm: ^3
- symfony/framework-bundle: ^6.3 || ^7
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.58.1
- phpunit/phpunit: ^11.1.3
- ramsey/uuid: ^4.7
This package is auto-updated.
Last update: 2024-10-10 10:31:48 UTC
README
namespace App\Entity; use Arthem\ObjectReferenceBundle\Mapping\Attribute\ObjectReference; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class Story { #[ORM\Column(type: Types::STRING, length: 36, nullable: true)] #[ObjectReference(keyLength: 15)] private \Closure|Actor $actor; private $actorId; // must be declared, even if not used private $actorType; // must be declared, even if not used /** * @return object|null */ public function getActor(): ?Actor { if ($this->actor instanceof \Closure) { $this->actor = $this->actor->call($this); } return $this->actor; } public function setActor(?Actor $actor) { $this->actor = $actor; } }