src/Entity/Formation.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity
  10.  * @ORM\Table(name="mmpp_formation")
  11.  * @ORM\Entity(repositoryClass="App\Repository\FormationRepository")
  12.  */
  13. class Formation
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\Column(type="integer")
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     protected $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     protected $title;
  25.     /**
  26.      * @ORM\Column(type="text")
  27.      * @var string
  28.      */
  29.     protected $content;
  30.     /**
  31.      * @ORM\Column(name="is_active", type="boolean")
  32.      */
  33.     protected $isActive true;
  34.     /**
  35.      * @Gedmo\Timestampable(on="create")
  36.      * @ORM\Column(type="datetime", name="created_on")
  37.      * @var \DateTime
  38.      */
  39.     protected $createdOn;
  40.     /**
  41.      * @Gedmo\Timestampable(on="update")
  42.      * @ORM\Column(type="datetime", name="updated_on")
  43.      * @var \DateTime
  44.      */
  45.     protected $updatedOn;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity="FormationGroup", inversedBy="formations")
  48.      * @ORM\JoinColumn(name="formation_group_id", referencedColumnName="id")
  49.      */
  50.     protected $group;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity="Tarif", mappedBy="formation")
  53.      */
  54.     protected $tarifs;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity="Document", mappedBy="formation")
  57.      */
  58.     protected $documents;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity="Formulaire", inversedBy="formations")
  61.      * @ORM\JoinColumn(name="formulaire_id", referencedColumnName="id")
  62.      */
  63.     protected $formulaire;
  64.     /**
  65.      * @ORM\Column(type="string", name="meta_description", nullable=true, length=255)
  66.      * @var String
  67.      */
  68.     protected $metaDescription;
  69.     public function __construct()
  70.     {
  71.         $this->tarifs = new ArrayCollection();
  72.         $this->documents = new ArrayCollection();
  73.     }
  74.     public function getFullTitle()
  75.     {
  76.         return $this->group->getName().' / '.$this->title;
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getTitle(): ?string
  83.     {
  84.         return $this->title;
  85.     }
  86.     public function setTitle(string $title): self
  87.     {
  88.         $this->title $title;
  89.         return $this;
  90.     }
  91.     public function getContent(): ?string
  92.     {
  93.         return $this->content;
  94.     }
  95.     public function setContent(string $content): self
  96.     {
  97.         $this->content $content;
  98.         return $this;
  99.     }
  100.     public function isIsActive(): ?bool
  101.     {
  102.         return $this->isActive;
  103.     }
  104.     public function setIsActive(bool $isActive): self
  105.     {
  106.         $this->isActive $isActive;
  107.         return $this;
  108.     }
  109.     public function getCreatedOn(): ?\DateTimeInterface
  110.     {
  111.         return $this->createdOn;
  112.     }
  113.     public function setCreatedOn(\DateTimeInterface $createdOn): self
  114.     {
  115.         $this->createdOn $createdOn;
  116.         return $this;
  117.     }
  118.     public function getUpdatedOn(): ?\DateTimeInterface
  119.     {
  120.         return $this->updatedOn;
  121.     }
  122.     public function setUpdatedOn(\DateTimeInterface $updatedOn): self
  123.     {
  124.         $this->updatedOn $updatedOn;
  125.         return $this;
  126.     }
  127.     public function getMetaDescription(): ?string
  128.     {
  129.         return $this->metaDescription;
  130.     }
  131.     public function setMetaDescription(?string $metaDescription): self
  132.     {
  133.         $this->metaDescription $metaDescription;
  134.         return $this;
  135.     }
  136.     public function getGroup(): ?FormationGroup
  137.     {
  138.         return $this->group;
  139.     }
  140.     public function setGroup(?FormationGroup $group): self
  141.     {
  142.         $this->group $group;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Tarif>
  147.      */
  148.     public function getTarifs(): Collection
  149.     {
  150.         return $this->tarifs;
  151.     }
  152.     public function addTarif(Tarif $tarif): self
  153.     {
  154.         if (!$this->tarifs->contains($tarif)) {
  155.             $this->tarifs->add($tarif);
  156.             $tarif->setFormation($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeTarif(Tarif $tarif): self
  161.     {
  162.         if ($this->tarifs->removeElement($tarif)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($tarif->getFormation() === $this) {
  165.                 $tarif->setFormation(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Document>
  172.      */
  173.     public function getDocuments(): Collection
  174.     {
  175.         return $this->documents;
  176.     }
  177.     public function addDocument(Document $document): self
  178.     {
  179.         if (!$this->documents->contains($document)) {
  180.             $this->documents->add($document);
  181.             $document->setFormation($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeDocument(Document $document): self
  186.     {
  187.         if ($this->documents->removeElement($document)) {
  188.             // set the owning side to null (unless already changed)
  189.             if ($document->getFormation() === $this) {
  190.                 $document->setFormation(null);
  191.             }
  192.         }
  193.         return $this;
  194.     }
  195.     public function getFormulaire(): ?Formulaire
  196.     {
  197.         return $this->formulaire;
  198.     }
  199.     public function setFormulaire(?Formulaire $formulaire): self
  200.     {
  201.         $this->formulaire $formulaire;
  202.         return $this;
  203.     }
  204. }