src/Entity/IdentiteVisuelle.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\IdentiteVisuelleRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassIdentiteVisuelleRepository::class)]
  8. class IdentiteVisuelle
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\OneToOne(targetEntityAccountingFirm::class, inversedBy'identiteVisuelle'cascade: ['persist''remove'])]
  15.     private $accountingFirm;
  16.     #[ORM\OneToMany(targetEntityIdentiteVisuelleFile::class, mappedBy'identiteVisuelle'orphanRemovaltruecascade: ['persist''remove'])]
  17.     private $file;
  18.     #[ORM\Column(type'datetime')]
  19.     private $updatedAt;
  20.     #[ORM\Column(type'boolean'nullabletrue)]
  21.     private $sendMailAccesClientTmp;
  22.     public function __construct()
  23.     {
  24.         $this->file = new ArrayCollection();
  25.         $this->identiteVisuelleCategories = new ArrayCollection();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getAccountingFirm(): ?AccountingFirm
  32.     {
  33.         return $this->accountingFirm;
  34.     }
  35.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  36.     {
  37.         $this->accountingFirm $accountingFirm;
  38.         $this->updatedAt = new \DateTime('now');
  39.         return $this;
  40.     }
  41.     /**
  42.      * @return Collection<int, IdentiteVisuelleFile>
  43.      */
  44.     public function getFile(): Collection
  45.     {
  46.         return $this->file;
  47.     }
  48.     public function addFile(IdentiteVisuelleFile $file): self
  49.     {
  50.         if (!$this->file->contains($file)) {
  51.             $this->file[] = $file;
  52.             $file->setIdentiteVisuelle($this);
  53.             $this->updatedAt = new \DateTime('now');
  54.         }
  55.         return $this;
  56.     }
  57.     public function removeFile(IdentiteVisuelleFile $file): self
  58.     {
  59.         if ($this->file->removeElement($file)) {
  60.             // set the owning side to null (unless already changed)
  61.             if ($file->getIdentiteVisuelle() === $this) {
  62.                 $file->setIdentiteVisuelle(null);
  63.                 $this->updatedAt = new \DateTime('now');
  64.             }
  65.         }
  66.         return $this;
  67.     }
  68.     public function getUpdatedAt(): ?\DateTimeInterface
  69.     {
  70.         return $this->updatedAt;
  71.     }
  72.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  73.     {
  74.         $this->updatedAt $updatedAt;
  75.         return $this;
  76.     }
  77.     public function isSendMailAccesClientTmp(): ?bool
  78.     {
  79.         return $this->sendMailAccesClientTmp;
  80.     }
  81.     public function setSendMailAccesClientTmp(?bool $sendMailAccesClientTmp): self
  82.     {
  83.         $this->sendMailAccesClientTmp $sendMailAccesClientTmp;
  84.         return $this;
  85.     }
  86.     
  87.     public function countFilesByCategory(string $category): int
  88.     {
  89.         return $this->file->filter(function($f) use ($category) {
  90.             return $f->getCategorie() === $category;
  91.         })->count();
  92.     }
  93. }