213 lines
4.3 KiB
PHP
213 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Core\Entity\EntityInterface;
|
|
use App\Repository\SpeakerRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use App\Security\EncryptedEntityInterface;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass=SpeakerRepository::class)
|
|
*/
|
|
class Speaker implements EntityInterface, EncryptedEntityInterface
|
|
{
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
protected $id;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255)
|
|
*/
|
|
protected $name;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity=Intervention::class, mappedBy="speakers", cascade={"persist"})
|
|
*/
|
|
protected $interventions;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
*/
|
|
protected $caldavHost;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
*/
|
|
protected $caldavUsername;
|
|
|
|
/**
|
|
* @ORM\Column(type="blob", nullable=true)
|
|
*/
|
|
protected $caldavPassword;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
*/
|
|
protected $caldavCalendarUri;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity=Event::class, mappedBy="speakers")
|
|
*/
|
|
private $events;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=30, nullable=true)
|
|
*/
|
|
private $color;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->interventions = new ArrayCollection();
|
|
$this->events = new ArrayCollection();
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return $this->getName();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): self
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Intervention>
|
|
*/
|
|
public function getInterventions(): Collection
|
|
{
|
|
return $this->interventions;
|
|
}
|
|
|
|
public function addIntervention(Intervention $intervention): self
|
|
{
|
|
if (!$this->interventions->contains($intervention)) {
|
|
$this->interventions[] = $intervention;
|
|
$intervention->addSpeaker($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeIntervention(Intervention $intervention): self
|
|
{
|
|
if ($this->interventions->removeElement($intervention)) {
|
|
$intervention->removeSpeaker($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCaldavHost(): ?string
|
|
{
|
|
return $this->caldavHost;
|
|
}
|
|
|
|
public function setCaldavHost(?string $caldavHost): self
|
|
{
|
|
$this->caldavHost = $caldavHost;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCaldavUsername(): ?string
|
|
{
|
|
return $this->caldavUsername;
|
|
}
|
|
|
|
public function setCaldavUsername(?string $caldavUsername): self
|
|
{
|
|
$this->caldavUsername = $caldavUsername;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCaldavPassword()
|
|
{
|
|
return $this->caldavPassword;
|
|
}
|
|
|
|
public function setCaldavPassword(?string $caldavPassword): self
|
|
{
|
|
$this->caldavPassword = $caldavPassword;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCaldavCalendarUri(): ?string
|
|
{
|
|
return $this->caldavCalendarUri;
|
|
}
|
|
|
|
public function setCaldavCalendarUri(?string $caldavCalendarUri): self
|
|
{
|
|
$this->caldavCalendarUri = $caldavCalendarUri;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEncryptedProperties(): array
|
|
{
|
|
return [
|
|
'caldavPassword',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Event>
|
|
*/
|
|
public function getEvents(): Collection
|
|
{
|
|
return $this->events;
|
|
}
|
|
|
|
public function addEvent(Event $event): self
|
|
{
|
|
if (!$this->events->contains($event)) {
|
|
$this->events[] = $event;
|
|
$event->addSpeaker($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeEvent(Event $event): self
|
|
{
|
|
if ($this->events->removeElement($event)) {
|
|
$event->removeSpeaker($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getColor(): ?string
|
|
{
|
|
return $this->color;
|
|
}
|
|
|
|
public function setColor(?string $color): self
|
|
{
|
|
$this->color = $color;
|
|
|
|
return $this;
|
|
}
|
|
}
|