Skip to content

Commit

Permalink
Merge pull request #44 from Nelly34/Nelly34-add-resourceId
Browse files Browse the repository at this point in the history
Add resourceId in Event.php
  • Loading branch information
tattali authored Sep 16, 2021
2 parents 1d9d49f + 948d3a8 commit 8c85376
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,23 @@ class Event
* @var array
*/
protected $options = [];

/**
* @var string
*/
protected $resourceId;

public function __construct(
string $title,
DateTimeInterface $start,
?DateTimeInterface $end = null,
?string $resourceId = null,
array $options = []
) {
$this->setTitle($title);
$this->setStart($start);
$this->setEnd($end);
$this->setResourceId($resourceId);
$this->setOptions($options);
}

Expand Down Expand Up @@ -89,6 +96,16 @@ public function setAllDay(bool $allDay): void
{
$this->allDay = $allDay;
}

public function getResourceId(): ?string
{
return $this->resourceId;
}

public function setResourceId(?string $resourceId): void
{
$this->resourceId = $resourceId;
}

public function getOptions(): array
{
Expand Down Expand Up @@ -144,6 +161,10 @@ public function toArray(): array
if (null !== $this->getEnd()) {
$event['end'] = $this->getEnd()->format(self::DATE_FORMAT);
}

if (null !== $this->getResourceId()) {
$event['resourceId'] = $this->getResourceId();
}

return array_merge($event, $this->getOptions());
}
Expand Down

0 comments on commit 8c85376

Please sign in to comment.