Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4rthem/object-reference-bundle
https://github.com/4rthem/object-reference-bundle
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/4rthem/object-reference-bundle
- Owner: 4rthem
- Created: 2019-10-21T17:12:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T09:52:50.000Z (8 months ago)
- Last Synced: 2024-10-11T21:21:16.135Z (4 months ago)
- Language: PHP
- Size: 96.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Object Reference bundle
```php
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;
}
}
```