<?phpnamespace App\Entity;use App\Repository\IdentiteVisuelleRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: IdentiteVisuelleRepository::class)]class IdentiteVisuelle{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\OneToOne(targetEntity: AccountingFirm::class, inversedBy: 'identiteVisuelle', cascade: ['persist', 'remove'])] private $accountingFirm; #[ORM\OneToMany(targetEntity: IdentiteVisuelleFile::class, mappedBy: 'identiteVisuelle', orphanRemoval: true, cascade: ['persist', 'remove'])] private $file; #[ORM\Column(type: 'datetime')] private $updatedAt; #[ORM\Column(type: 'boolean', nullable: true)] private $sendMailAccesClientTmp; public function __construct() { $this->file = new ArrayCollection(); $this->identiteVisuelleCategories = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getAccountingFirm(): ?AccountingFirm { return $this->accountingFirm; } public function setAccountingFirm(?AccountingFirm $accountingFirm): self { $this->accountingFirm = $accountingFirm; $this->updatedAt = new \DateTime('now'); return $this; } /** * @return Collection<int, IdentiteVisuelleFile> */ public function getFile(): Collection { return $this->file; } public function addFile(IdentiteVisuelleFile $file): self { if (!$this->file->contains($file)) { $this->file[] = $file; $file->setIdentiteVisuelle($this); $this->updatedAt = new \DateTime('now'); } return $this; } public function removeFile(IdentiteVisuelleFile $file): self { if ($this->file->removeElement($file)) { // set the owning side to null (unless already changed) if ($file->getIdentiteVisuelle() === $this) { $file->setIdentiteVisuelle(null); $this->updatedAt = new \DateTime('now'); } } return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function isSendMailAccesClientTmp(): ?bool { return $this->sendMailAccesClientTmp; } public function setSendMailAccesClientTmp(?bool $sendMailAccesClientTmp): self { $this->sendMailAccesClientTmp = $sendMailAccesClientTmp; return $this; } public function countFilesByCategory(string $category): int { return $this->file->filter(function($f) use ($category) { return $f->getCategorie() === $category; })->count(); }}