<?php
namespace App\Entity\Engagement;
use App\Entity\BonDeCommande;
use App\Entity\DocUpload;
use App\Entity\Fournisseur;
use App\Repository\EngagementBudgetEngageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Annotation\CustomAnnotation;
/**
* @ORM\Entity(repositoryClass=EngagementBudgetEngageRepository::class)
*/
class EngagementBudgetEngage
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="float", nullable=true)
* @CustomAnnotation("Montant total engagé")
*/
private $engageMontant;
/**
* @ORM\ManyToOne(targetEntity="\App\Entity\DocUpload", cascade={"persist"})
* @ORM\JoinColumn(name="file_devis_id", referencedColumnName="id",nullable=true,onDelete="SET NULL")
* @CustomAnnotation("Devis")
*/
private $devis;
/**
* @ORM\ManyToOne(targetEntity="\App\Entity\BonDeCommande", cascade={"persist"})
* @ORM\JoinColumn(name="bon_commande_id", referencedColumnName="id",nullable=true,onDelete="SET NULL")
* @CustomAnnotation("Bon De Commande")
*/
private $bonDeCommande;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $token;
/**
* @ORM\Column(type="text", nullable=true)
* @CustomAnnotation("Note interne")
*/
private $noteInterne;
/**
* @ORM\OneToMany(targetEntity="EngagementBudgetEngageComment",mappedBy="engagementBudgetEngage", cascade={"persist"})
*/
private $comment;
/**
* @ORM\OneToMany(targetEntity="EngagementBudgetEngageDetail",mappedBy="engagementBudgetEngage", cascade={"persist"})
*/
private $engagementBudgetEngageDetail;
/**
* @ORM\ManyToOne(targetEntity="\App\Entity\Fournisseur", cascade={"persist"})
* @ORM\JoinColumn(name="fournisseur_id", referencedColumnName="id",nullable=true)
* @CustomAnnotation("Fournisseur")
*/
private $fournisseur;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->token = md5(uniqid());
$this->comment = new ArrayCollection();
$this->engagementBudgetEngageDetail = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEngageMontant(): ?float
{
return $this->engageMontant;
}
public function setEngageMontant(?float $engageMontant): self
{
$this->engageMontant = $engageMontant;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
public function getNoteInterne(): ?string
{
return $this->noteInterne;
}
public function setNoteInterne(?string $noteInterne): self
{
$this->noteInterne = $noteInterne;
return $this;
}
public function getDevis(): ?DocUpload
{
return $this->devis;
}
public function setDevis(?DocUpload $devis): self
{
$this->devis = $devis;
return $this;
}
public function getBonDeCommande(): ?BonDeCommande
{
return $this->bonDeCommande;
}
public function setBonDeCommande(?BonDeCommande $bonDeCommande): self
{
$this->bonDeCommande = $bonDeCommande;
return $this;
}
/**
* @return Collection|EngagementBudgetEngageComment[]
*/
public function getComment(): Collection
{
return $this->comment;
}
public function addComment(EngagementBudgetEngageComment $comment): self
{
if (!$this->comment->contains($comment)) {
$this->comment[] = $comment;
$comment->setEngagementBudgetEngage($this);
}
return $this;
}
public function removeComment(EngagementBudgetEngageComment $comment): self
{
if ($this->comment->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getEngagementBudgetEngage() === $this) {
$comment->setEngagementBudgetEngage(null);
}
}
return $this;
}
public function getFournisseur(): ?Fournisseur
{
return $this->fournisseur;
}
public function setFournisseur(?Fournisseur $fournisseur): self
{
$this->fournisseur = $fournisseur;
return $this;
}
/**
* @return Collection|EngagementBudgetEngageDetail[]
*/
public function getEngagementBudgetEngageDetail(): Collection
{
return $this->engagementBudgetEngageDetail;
}
public function addEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
{
if (!$this->engagementBudgetEngageDetail->contains($detail)) {
$this->engagementBudgetEngageDetail[] = $detail;
$detail->setEngagementBudgetEngage($this);
}
return $this;
}
public function removeEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
{
if ($this->engagementBudgetEngageDetail->removeElement($detail)) {
if ($detail->getEngagementBudgetEngage() === $this) {
$detail->setEngagementBudgetEngage(null);
}
}
return $this;
}
}