diff --git a/src/Entity/Event.php b/src/Entity/Event.php index 607a04d..1fd7769 100644 --- a/src/Entity/Event.php +++ b/src/Entity/Event.php @@ -15,8 +15,6 @@ class Event * * @ORM\Id * @ORM\Column(type="Uuid", unique=true) - * @ORM\GeneratedValue(strategy="CUSTOM") - * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") */ protected $id; @@ -31,7 +29,7 @@ class Event /** * @var string * - * @ORM\Column(type="string") + * @ORM\Column(type="text") */ protected $description; @@ -41,8 +39,10 @@ class Event */ protected $eventType; - public function __construct() { - + public function __construct(string $title, EventType $eventType) { + $this->id = Uuid::uuid4(); + $this->title = $title; + $this->eventType = $eventType; } public function getId(): UuidInterface { diff --git a/src/Entity/EventType.php b/src/Entity/EventType.php index 8320c72..ceba819 100644 --- a/src/Entity/EventType.php +++ b/src/Entity/EventType.php @@ -25,7 +25,7 @@ class EventType /** * @var string|null - * @ORM\Column(type="text", nullable=true) + * @ORM\Column(type="string", nullable=true, length=512) */ protected $comment; diff --git a/src/Entity/SubEvent.php b/src/Entity/SubEvent.php index 2ade7b2..dd78ff9 100644 --- a/src/Entity/SubEvent.php +++ b/src/Entity/SubEvent.php @@ -15,11 +15,15 @@ class SubEvent * * @ORM\Id * @ORM\Column(type="Uuid", unique=true) - * @ORM\GeneratedValue(strategy="CUSTOM") - * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") */ protected $id; + /** + * @var Event + * + * @ORM\ManyToOne(targetEntity="Event") + */ + protected $parent; /** * @var string @@ -31,7 +35,7 @@ class SubEvent /** * @var string * - * @ORM\Column(type="string") + * @ORM\Column(type="text") */ protected $description; @@ -49,7 +53,9 @@ class SubEvent */ protected $endDate; - public function __construct(string $title, string $description, \DateTime $startDate, \DateTime $endDate) { + public function __construct(Event $parent, string $title, string $description, \DateTime $startDate, \DateTime $endDate) { + $this->id = Uuid::uuid4(); + $this->parent = $parent; $this->title = $title; $this->description = $description; $this->startDate = $startDate; @@ -60,6 +66,14 @@ public function getId(): UuidInterface { return $this->id; } + public function getParent(): Event { + return $this->parent; + } + + public function setParent(Event $parent): void { + $this->parent = $parent; + } + public function getTitle(): string { return $this->title; }