<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table(name="mmpp_formation")
* @ORM\Entity(repositoryClass="App\Repository\FormationRepository")
*/
class Formation
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255)
*/
protected $title;
/**
* @ORM\Column(type="text")
* @var string
*/
protected $content;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
protected $isActive = true;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime", name="created_on")
* @var \DateTime
*/
protected $createdOn;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime", name="updated_on")
* @var \DateTime
*/
protected $updatedOn;
/**
* @ORM\ManyToOne(targetEntity="FormationGroup", inversedBy="formations")
* @ORM\JoinColumn(name="formation_group_id", referencedColumnName="id")
*/
protected $group;
/**
* @ORM\OneToMany(targetEntity="Tarif", mappedBy="formation")
*/
protected $tarifs;
/**
* @ORM\OneToMany(targetEntity="Document", mappedBy="formation")
*/
protected $documents;
/**
* @ORM\ManyToOne(targetEntity="Formulaire", inversedBy="formations")
* @ORM\JoinColumn(name="formulaire_id", referencedColumnName="id")
*/
protected $formulaire;
/**
* @ORM\Column(type="string", name="meta_description", nullable=true, length=255)
* @var String
*/
protected $metaDescription;
public function __construct()
{
$this->tarifs = new ArrayCollection();
$this->documents = new ArrayCollection();
}
public function getFullTitle()
{
return $this->group->getName().' / '.$this->title;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getCreatedOn(): ?\DateTimeInterface
{
return $this->createdOn;
}
public function setCreatedOn(\DateTimeInterface $createdOn): self
{
$this->createdOn = $createdOn;
return $this;
}
public function getUpdatedOn(): ?\DateTimeInterface
{
return $this->updatedOn;
}
public function setUpdatedOn(\DateTimeInterface $updatedOn): self
{
$this->updatedOn = $updatedOn;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getGroup(): ?FormationGroup
{
return $this->group;
}
public function setGroup(?FormationGroup $group): self
{
$this->group = $group;
return $this;
}
/**
* @return Collection<int, Tarif>
*/
public function getTarifs(): Collection
{
return $this->tarifs;
}
public function addTarif(Tarif $tarif): self
{
if (!$this->tarifs->contains($tarif)) {
$this->tarifs->add($tarif);
$tarif->setFormation($this);
}
return $this;
}
public function removeTarif(Tarif $tarif): self
{
if ($this->tarifs->removeElement($tarif)) {
// set the owning side to null (unless already changed)
if ($tarif->getFormation() === $this) {
$tarif->setFormation(null);
}
}
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents->add($document);
$document->setFormation($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getFormation() === $this) {
$document->setFormation(null);
}
}
return $this;
}
public function getFormulaire(): ?Formulaire
{
return $this->formulaire;
}
public function setFormulaire(?Formulaire $formulaire): self
{
$this->formulaire = $formulaire;
return $this;
}
}