<?php
namespace App\Entity;
use App\Repository\PipelineMajWebRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PipelineMajWebRepository::class)]
class PipelineMajWeb
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: AccountingFirm::class)]
#[ORM\JoinColumn(nullable: false)]
private ?AccountingFirm $accountingFirm = null;
#[ORM\Column(type: 'string', length: 255)]
private string $status = PipelineMajWebStatus::NEW;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $trelloCardId = null;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $createdAt;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $updatedAt;
#[ORM\OneToMany(mappedBy: 'pipelineMajWeb', targetEntity: PipelineMajWebMessage::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => 'ASC'])]
private Collection $messages;
public function __construct()
{
$this->messages = new ArrayCollection();
$now = new \DateTimeImmutable();
$this->createdAt = $now;
$this->updatedAt = $now;
}
public function getId(): ?int { return $this->id; }
public function getAccountingFirm(): ?AccountingFirm { return $this->accountingFirm; }
public function setAccountingFirm(?AccountingFirm $accountingFirm): self { $this->accountingFirm = $accountingFirm; return $this; }
public function getStatus(): string { return $this->status; }
public function setStatus(string $status): self { $this->status = $status; return $this; }
public function getEmail(): ?string { return $this->email; }
public function setEmail(?string $email): self { $this->email = $email; return $this; }
public function getTrelloCardId(): ?string { return $this->trelloCardId; }
public function setTrelloCardId(?string $trelloCardId): self { $this->trelloCardId = $trelloCardId; return $this; }
public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; }
public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; }
public function getUpdatedAt(): \DateTimeImmutable { return $this->updatedAt; }
public function setUpdatedAt(\DateTimeImmutable $updatedAt): self { $this->updatedAt = $updatedAt; return $this; }
/** @return Collection<int, PipelineMajWebMessage> */
public function getMessages(): Collection { return $this->messages; }
public function addMessage(PipelineMajWebMessage $message): self
{
if (!$this->messages->contains($message)) {
$this->messages[] = $message;
$message->setPipelineMajWeb($this);
}
return $this;
}
public function removeMessage(PipelineMajWebMessage $message): self
{
if ($this->messages->removeElement($message)) {
if ($message->getPipelineMajWeb() === $this) {
$message->setPipelineMajWeb(null);
}
}
return $this;
}
public function touch(): void
{
$this->updatedAt = new \DateTimeImmutable();
}
}