src/Entity/RessourceDirectory.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RessourceDirectoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassRessourceDirectoryRepository::class)]
  9. class RessourceDirectory
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[ORM\Column]
  18.     private ?bool $isActive true;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $addedAt null;
  21.     #[ORM\OneToMany(mappedBy'directory'targetEntityRessource::class, orphanRemovaltrue)]
  22.     private Collection $ressources;
  23.     #[ORM\ManyToOne(inversedBy'ressourceDirectories')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Project $project null;
  26.     public function __construct()
  27.     {
  28.         $this->ressources = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getTitle(): ?string
  35.     {
  36.         return $this->title;
  37.     }
  38.     public function setTitle(string $title): self
  39.     {
  40.         $this->title $title;
  41.         return $this;
  42.     }
  43.     public function isIsActive(): ?bool
  44.     {
  45.         return $this->isActive;
  46.     }
  47.     public function setIsActive(bool $isActive): self
  48.     {
  49.         $this->isActive $isActive;
  50.         return $this;
  51.     }
  52.     public function getAddedAt(): ?\DateTimeInterface
  53.     {
  54.         return $this->addedAt;
  55.     }
  56.     public function setAddedAt(?\DateTimeInterface $addedAt): self
  57.     {
  58.         $this->addedAt $addedAt;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, Ressource>
  63.      */
  64.     public function getRessources(): Collection
  65.     {
  66.         return $this->ressources;
  67.     }
  68.     public function addRessource(Ressource $ressource): self
  69.     {
  70.         if (!$this->ressources->contains($ressource)) {
  71.             $this->ressources->add($ressource);
  72.             $ressource->setDirectory($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeRessource(Ressource $ressource): self
  77.     {
  78.         if ($this->ressources->removeElement($ressource)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($ressource->getDirectory() === $this) {
  81.                 $ressource->setDirectory(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     public function getProject(): ?Project
  87.     {
  88.         return $this->project;
  89.     }
  90.     public function setProject(?Project $project): self
  91.     {
  92.         $this->project $project;
  93.         return $this;
  94.     }
  95. }