<?php
namespace App\Entity;
use App\Enum\PipelineIdentiteVisuelleMajItemStatus;
use App\Repository\PipelineIdentiteVisuelleMajItemRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PipelineIdentiteVisuelleMajItemRepository::class)]
class PipelineIdentiteVisuelleMajItem
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: PipelineIdentiteVisuelleMaj::class, inversedBy: 'items')]
#[ORM\JoinColumn(nullable: false)]
private ?PipelineIdentiteVisuelleMaj $pipeline = null;
#[ORM\Column(type: 'string', length: 50)]
private string $type;
#[ORM\Column(type: 'string', length: 30)]
private string $status = PipelineIdentiteVisuelleMajItemStatus::NEW;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $clientComment = null;
#[ORM\Column(type: 'integer')]
private int $step = 0; // incrémenté à chaque envoi de propositions
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $validatedAt = null;
#[ORM\OneToMany(mappedBy: 'item', targetEntity: PipelineIdentiteVisuelleMajProposal::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $proposals;
#[ORM\OneToMany(mappedBy: 'item', targetEntity: PipelineIdentiteVisuelleMajMessage::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $messages;
public function __construct()
{
$this->proposals = new ArrayCollection();
$this->messages = new ArrayCollection();
}
public function getId(): ?int { return $this->id; }
public function getPipeline(): ?PipelineIdentiteVisuelleMaj { return $this->pipeline; }
public function setPipeline(?PipelineIdentiteVisuelleMaj $pipeline): self { $this->pipeline = $pipeline; return $this; }
public function getType(): string { return $this->type; }
public function setType(string $type): self { $this->type = $type; return $this; }
public function getStatus(): string { return $this->status; }
public function setStatus(string $status): self { $this->status = $status; return $this; }
public function getClientComment(): ?string { return $this->clientComment; }
public function setClientComment(?string $comment): self { $this->clientComment = $comment; return $this; }
public function getStep(): int { return $this->step; }
public function setStep(int $step): self { $this->step = $step; return $this; }
public function getValidatedAt(): ?\DateTimeImmutable { return $this->validatedAt; }
public function setValidatedAt(?\DateTimeImmutable $dt): self { $this->validatedAt = $dt; return $this; }
/** @return Collection<int, PipelineIdentiteVisuelleMajProposal> */
public function getProposals(): Collection { return $this->proposals; }
public function addProposal(PipelineIdentiteVisuelleMajProposal $proposal): self
{
if (!$this->proposals->contains($proposal)) {
$this->proposals->add($proposal);
$proposal->setItem($this);
}
return $this;
}
public function removeProposal(PipelineIdentiteVisuelleMajProposal $proposal): self
{
if ($this->proposals->removeElement($proposal)) {
if ($proposal->getItem() === $this) {
$proposal->setItem(null);
}
}
return $this;
}
/** @return Collection<int, PipelineIdentiteVisuelleMajMessage> */
public function getMessages(): Collection { return $this->messages; }
public function addMessage(PipelineIdentiteVisuelleMajMessage $message): self
{
if (!$this->messages->contains($message)) {
$this->messages->add($message);
$message->setItem($this);
}
return $this;
}
}