170 lines
3.3 KiB
PHP
170 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Core\Entity\EntityInterface;
|
|
use App\Repository\EventRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass=EventRepository::class)
|
|
*/
|
|
class Event implements EntityInterface
|
|
{
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
protected $id;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=40)
|
|
*/
|
|
protected $uid;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
*/
|
|
protected $summary;
|
|
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $description;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
protected $startAt;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
protected $finishAt;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity=Project::class, inversedBy="events", cascade={"persist", "remove"})
|
|
* @ORM\JoinColumn(nullable=false)
|
|
*/
|
|
protected $projects;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity=Speaker::class, inversedBy="events")
|
|
*/
|
|
private $speakers;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->speakers = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getUid(): ?string
|
|
{
|
|
return $this->uid;
|
|
}
|
|
|
|
public function setUid(string $uid): self
|
|
{
|
|
$this->uid = $uid;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSummary(): ?string
|
|
{
|
|
return $this->summary;
|
|
}
|
|
|
|
public function setSummary(?string $summary): self
|
|
{
|
|
$this->summary = $summary;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCleanedDescription(): string
|
|
{
|
|
return trim(preg_replace('/\s*#\{project:\d+\}\s*/', "\n", $this->getDescription()));
|
|
}
|
|
|
|
public function getDescription(): ?string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(?string $description): self
|
|
{
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStartAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->startAt;
|
|
}
|
|
|
|
public function setStartAt(?\DateTimeInterface $startAt): self
|
|
{
|
|
$this->startAt = $startAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getFinishAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->finishAt;
|
|
}
|
|
|
|
public function setFinishAt(?\DateTimeInterface $finishAt): self
|
|
{
|
|
$this->finishAt = $finishAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getProjects(): ?Project
|
|
{
|
|
return $this->projects;
|
|
}
|
|
|
|
public function setProjects(?Project $projects): self
|
|
{
|
|
$this->projects = $projects;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Speaker>
|
|
*/
|
|
public function getSpeakers(): Collection
|
|
{
|
|
return $this->speakers;
|
|
}
|
|
|
|
public function addSpeaker(Speaker $speaker): self
|
|
{
|
|
if (!$this->speakers->contains($speaker)) {
|
|
$this->speakers[] = $speaker;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeSpeaker(Speaker $speaker): self
|
|
{
|
|
$this->speakers->removeElement($speaker);
|
|
|
|
return $this;
|
|
}
|
|
}
|