<?php
namespace App\Entity\Engagement;
use App\Entity\Project;
use App\Repository\EngagementProjetRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Annotation\CustomAnnotation;
/**
* @ORM\Entity(repositoryClass=EngagementProjetRepository::class)
*/
class EngagementProjet
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="\App\Entity\Project", cascade={"persist"})
* @ORM\JoinColumn(name="project_id", referencedColumnName="id",nullable=true,onDelete="SET NULL")
* @CustomAnnotation("Projet")
*/
private $projet;
/**
* @ORM\OneToMany(targetEntity="EngagementVersion",mappedBy="engagementProjet", cascade={"persist"})
*/
private $engagementVersion;
public function __construct()
{
$this->engagementVersion = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getProjet(): ?Project
{
return $this->projet;
}
public function setProjet(?Project $projet): self
{
$this->projet = $projet;
return $this;
}
/**
* @return Collection|EngagementVersion[]
*/
public function getEngagementVersion(): Collection
{
return $this->engagementVersion;
}
public function addEngagementVersion(EngagementVersion $engagementVersion): self
{
if (!$this->engagementVersion->contains($engagementVersion)) {
$this->engagementVersion[] = $engagementVersion;
$engagementVersion->setEngagementProjet($this);
}
return $this;
}
public function removeEngagementVersion(EngagementVersion $engagementVersion): self
{
if ($this->engagementVersion->removeElement($engagementVersion)) {
// set the owning side to null (unless already changed)
if ($engagementVersion->getEngagementProjet() === $this) {
$engagementVersion->setEngagementProjet(null);
}
}
return $this;
}
}