<?php
namespace App\Entity;
use App\Repository\RessourceDirectoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RessourceDirectoryRepository::class)]
class RessourceDirectory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column]
private ?bool $isActive = true;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $addedAt = null;
#[ORM\OneToMany(mappedBy: 'directory', targetEntity: Ressource::class, orphanRemoval: true)]
private Collection $ressources;
#[ORM\ManyToOne(inversedBy: 'ressourceDirectories')]
#[ORM\JoinColumn(nullable: false)]
private ?Project $project = null;
public function __construct()
{
$this->ressources = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getAddedAt(): ?\DateTimeInterface
{
return $this->addedAt;
}
public function setAddedAt(?\DateTimeInterface $addedAt): self
{
$this->addedAt = $addedAt;
return $this;
}
/**
* @return Collection<int, Ressource>
*/
public function getRessources(): Collection
{
return $this->ressources;
}
public function addRessource(Ressource $ressource): self
{
if (!$this->ressources->contains($ressource)) {
$this->ressources->add($ressource);
$ressource->setDirectory($this);
}
return $this;
}
public function removeRessource(Ressource $ressource): self
{
if ($this->ressources->removeElement($ressource)) {
// set the owning side to null (unless already changed)
if ($ressource->getDirectory() === $this) {
$ressource->setDirectory(null);
}
}
return $this;
}
public function getProject(): ?Project
{
return $this->project;
}
public function setProject(?Project $project): self
{
$this->project = $project;
return $this;
}
}