<?phpnamespace App\Entity;use App\Repository\PSGRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PSGRepository::class)]class PSG{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column] private ?bool $isValided = null; #[ORM\Column(type: Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $dateStart = null; #[ORM\Column(type: Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $dateEnd = null; #[ORM\OneToOne(mappedBy: 'psg', cascade: ['persist', 'remove'])] private ?Analyse $analyse = null; #[ORM\OneToMany(mappedBy: 'Psg', targetEntity: Enjeux::class)] private Collection $enjeuxes; #[ORM\Column] private ?int $status = null; public function __construct() { $this->enjeuxes = new ArrayCollection(); $this->isValided = false; $this->status = 0; } public function getId(): ?int { return $this->id; } public function setIsValided(bool $isValided): static { $this->isValided = $isValided; return $this; } public function getIsValided(): bool { return $this->isValided; } public function getDateStart(): ?\DateTimeInterface { return $this->dateStart; } public function setDateStart(\DateTimeInterface $dateStart): static { $this->dateStart = $dateStart; return $this; } public function getDateEnd(): ?\DateTimeInterface { return $this->dateEnd; } public function setDateEnd(\DateTimeInterface $dateEnd): static { $this->dateEnd = $dateEnd; return $this; } public function getAnalyse(): ?Analyse { return $this->analyse; } public function setAnalyse(?Analyse $analyse): static { // unset the owning side of the relation if necessary if ($analyse === null && $this->analyse !== null) { $this->analyse->setPsg(null); } // set the owning side of the relation if necessary if ($analyse !== null && $analyse->getPsg() !== $this) { $analyse->setPsg($this); } $this->analyse = $analyse; return $this; } /** * @return Collection<int, Enjeux> */ public function getEnjeuxes(): Collection { return $this->enjeuxes; } public function addEnjeux(Enjeux $enjeux): static { if (!$this->enjeuxes->contains($enjeux)) { $this->enjeuxes->add($enjeux); $enjeux->setPsg($this); } return $this; } public function removeEnjeux(Enjeux $enjeux): static { if ($this->enjeuxes->removeElement($enjeux)) { // set the owning side to null (unless already changed) if ($enjeux->getPsg() === $this) { $enjeux->setPsg(null); } } return $this; } public function getStatus(): ?int { return $this->status; } public function setStatus(int $status): static { $this->status = $status; return $this; } public function displayStatus(): string { return $this->status == 0 ? 'Brouillon': 'Encore cours'; } public function orientations(): array { $orientations = []; foreach ($this->getEnjeuxes() as $enjeux) { foreach ($enjeux->getOrientation() as $orientation) { $orientations[] = $orientation; } } return $orientations; } }