Created
July 14, 2015 21:34
-
-
Save blrobin2/844fd83a216aac967213 to your computer and use it in GitHub Desktop.
I like to use Doctrine in Laravel, and I needed an annotated event store class for the table. If you utilize event sourcing, and especially if you use Qandidate Labs Broadway package, this could be useful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Doctrine\ORM\Mapping as ORM; | |
| /** | |
| * Class EventStore | |
| * | |
| * @ORM\Entity | |
| * @ORM\Table(name="event_store") | |
| */ | |
| class EventStore | |
| { | |
| /** | |
| * @ORM\Id | |
| * @ORM\GeneratedValue | |
| * @ORM\Column(type="integer", name="id") | |
| */ | |
| private $id; | |
| /** | |
| * @ORM\Column(type="string", name="uuid", length=36, unique=true) | |
| */ | |
| private $uuid; | |
| /** | |
| * @ORM\Column(type="integer", name="playhead", unique=true, options={"unsigned":true}) | |
| */ | |
| private $playhead; | |
| /** | |
| * @ORM\Column(type="text", name="metadata") | |
| */ | |
| private $metadata; | |
| /** | |
| * @ORM\Column(type="text", name="payload") | |
| */ | |
| private $payload; | |
| /** | |
| * @ORM\Column(type="string", name="recorded_on", length=32) | |
| */ | |
| private $recorded_on; | |
| /** | |
| * @ORM\Column(type="text", name="type") | |
| */ | |
| private $type; | |
| /** | |
| * @param $uuid | |
| * @param $playhead | |
| * @param $metadata | |
| * @param $payload | |
| * @param $recorded_on | |
| * @param $type | |
| */ | |
| public function __construct($uuid, $playhead, $metadata, $payload, $recorded_on, $type) | |
| { | |
| $this->uuid = $uuid; | |
| $this->playhead = $playhead; | |
| $this->metadata = $metadata; | |
| $this->payload = $payload; | |
| $this->recorded_on = $recorded_on; | |
| $this->type = $type; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment