| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Message;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Core\File;
- use App\Entity\Organization\Organization;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Classe ... qui ...
- */
- // #[Auditable]
- #[ApiResource(operations: [])]
- #[ORM\Entity]
- class TemplateSystem
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\ManyToOne]
- private ?Organization $organization = null;
- /** @var Collection<int, File> */
- #[ORM\OneToMany(targetEntity: File::class, mappedBy: 'templateSystem', orphanRemoval: true)]
- private Collection $files;
- public function __construct()
- {
- $this->files = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * @return Collection<int, File>
- */
- public function getFiles(): Collection
- {
- return $this->files;
- }
- public function addFile(File $file): self
- {
- if (!$this->files->contains($file)) {
- $this->files[] = $file;
- $file->setTemplateSystem($this);
- }
- return $this;
- }
- public function removeFile(File $file): self
- {
- if ($this->files->removeElement($file)) {
- // set the owning side to null (unless already changed)
- if ($file->getTemplateSystem() === $this) {
- $file->setTemplateSystem(null);
- }
- }
- return $this;
- }
- }
|