src/Entity/Source.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SourceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SourceRepository::class)
  9.  */
  10. class Source
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $isDefault;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Document::class, mappedBy="source")
  28.      */
  29.     private $documents;
  30.     /**
  31.      * @ORM\Column(type="string", length=64, nullable=true, options={"comment":"Classe d’icône FontAwesome"})
  32.      */
  33.     private ?string $icon null;
  34.     /**
  35.      * @ORM\Column(type="string", length=16, nullable=true, options={"comment":"Couleur hex pour les graphiques"})
  36.      */
  37.     private ?string $color null;
  38.     public function getColor(): ?string { return $this->color; }
  39.     public function setColor(?string $color): self $this->color $color; return $this; }
  40.     public function getIcon(): ?string { return $this->icon; }
  41.     public function setIcon(?string $icon): self $this->icon $icon; return $this; }
  42.     public function __construct()
  43.     {
  44.         $this->documents = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getName(): ?string
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     public function getIsDefault(): ?bool
  60.     {
  61.         return $this->isDefault;
  62.     }
  63.     public function setIsDefault(?bool $isDefault): self
  64.     {
  65.         $this->isDefault $isDefault;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection|Document[]
  70.      */
  71.     public function getDocuments(): Collection
  72.     {
  73.         return $this->documents;
  74.     }
  75.     public function addDocument(Document $document): self
  76.     {
  77.         if( !$this->documents->contains($document)) {
  78.             $this->documents[] = $document;
  79.             $document->setSource($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeDocument(Document $document): self
  84.     {
  85.         if( $this->documents->removeElement($document)) {
  86.             // set the owning side to null (unless already changed)
  87.             if( $document->getSource() === $this) {
  88.                 $document->setSource(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93. }