<?php
namespace App\Entity;
use App\Repository\SourceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SourceRepository::class)
*/
class Source
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isDefault;
/**
* @ORM\OneToMany(targetEntity=Document::class, mappedBy="source")
*/
private $documents;
/**
* @ORM\Column(type="string", length=64, nullable=true, options={"comment":"Classe d’icône FontAwesome"})
*/
private ?string $icon = null;
/**
* @ORM\Column(type="string", length=16, nullable=true, options={"comment":"Couleur hex pour les graphiques"})
*/
private ?string $color = null;
public function getColor(): ?string { return $this->color; }
public function setColor(?string $color): self { $this->color = $color; return $this; }
public function getIcon(): ?string { return $this->icon; }
public function setIcon(?string $icon): self { $this->icon = $icon; return $this; }
public function __construct()
{
$this->documents = new ArrayCollection();
}
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;
}
public function getIsDefault(): ?bool
{
return $this->isDefault;
}
public function setIsDefault(?bool $isDefault): self
{
$this->isDefault = $isDefault;
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if( !$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setSource($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if( $this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if( $document->getSource() === $this) {
$document->setSource(null);
}
}
return $this;
}
}