<?php
namespace App\Entity;
use App\Entity\Logs;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\DeliverableVersions;
use Doctrine\Common\Collections\Collection;
use App\Repository\ProjectDeliverableRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: ProjectDeliverableRepository::class)]
class ProjectDeliverable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups('projects:admin-get-all')]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups('projects:admin-get-all')]
private ?string $title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Groups('projects:admin-get-all')]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups('projects:admin-get-all')]
private ?\DateTimeInterface $createdAt = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
#[Groups('projects:admin-get-all')]
private ?Status $status = null;
#[ORM\ManyToOne(inversedBy: 'projectDeliverables')]
private ?Project $project = null;
#[ORM\Column]
#[Groups('projects:admin-get-all')]
private ?int $forecast_versions = null;
#[ORM\OneToMany(mappedBy: 'deliverable', targetEntity: DeliverableVersions::class, cascade:['persist','remove'])]
private Collection $deliverableVersions;
#[ORM\OneToMany(mappedBy: 'livrable', targetEntity: Logs::class, cascade:['remove'])]
#[ORM\OrderBy(['createdAt'=>'DESC'])]
private Collection $logs;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable:true)]
#[Groups('projects:admin-get-all')]
private ?\DateTimeInterface $LivraisonDate = null;
#[ORM\ManyToOne]
private ?ProjectType $type = null;
public function __construct()
{
$this->deliverableVersions = new ArrayCollection();
$this->logs = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getStatus(): ?Status
{
return $this->status;
}
public function setStatus(?Status $status): self
{
$this->status = $status;
return $this;
}
public function getProject(): ?Project
{
return $this->project;
}
public function setProject(?Project $project): self
{
$this->project = $project;
return $this;
}
public function getForecastVersions(): ?int
{
return $this->forecast_versions;
}
public function setForecastVersions(int $forecast_versions): self
{
$this->forecast_versions = $forecast_versions;
return $this;
}
/**
* @return Collection<int, DeliverableVersions>
*/
public function getDeliverableVersions(): Collection
{
return $this->deliverableVersions;
}
public function addDeliverableVersion(DeliverableVersions $deliverableVersion): self
{
if (!$this->deliverableVersions->contains($deliverableVersion)) {
$this->deliverableVersions->add($deliverableVersion);
$deliverableVersion->setDeliverable($this);
}
return $this;
}
public function removeDeliverableVersion(DeliverableVersions $deliverableVersion): self
{
if ($this->deliverableVersions->removeElement($deliverableVersion)) {
// set the owning side to null (unless already changed)
if ($deliverableVersion->getDeliverable() === $this) {
$deliverableVersion->setDeliverable(null);
}
}
return $this;
}
/**
* @return Collection<int, Logs>
*/
public function getLogs(): Collection
{
return $this->logs;
}
public function addLog(Logs $log): self
{
if (!$this->logs->contains($log)) {
$this->logs->add($log);
$log->setLivrable($this);
}
return $this;
}
public function removeLog(Logs $log): self
{
if ($this->logs->removeElement($log)) {
// set the owning side to null (unless already changed)
if ($log->getLivrable() === $this) {
$log->setLivrable(null);
}
}
return $this;
}
public function getLivraisonDate(): ?\DateTimeInterface
{
return $this->LivraisonDate;
}
public function setLivraisonDate(?\DateTimeInterface $LivraisonDate): self
{
$this->LivraisonDate = $LivraisonDate;
return $this;
}
public function getType(): ?ProjectType
{
return $this->type;
}
public function setType(?ProjectType $type): self
{
$this->type = $type;
return $this;
}
}