src\Entity\Package.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PackageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPackageRepository::class)]
  8. class Package
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255uniquetrue)]
  15.     private $code;
  16.     #[ORM\Column(type'float'nullabletrue)]
  17.     private $prix;
  18.     #[ORM\Column(type'integer')]
  19.     private $type;
  20.     #[ORM\Column(type'integer'nullabletrue)]
  21.     private $duree;
  22.     #[ORM\Column(type'integer')]
  23.     private $min;
  24.     #[ORM\Column(type'boolean')]
  25.     private $status;
  26.     #[ORM\JoinColumn(nullablefalse)]
  27.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'packages')]
  28.     private $user;
  29.     #[ORM\Column(type'datetime')]
  30.     private $created_at;
  31.     #[ORM\Column(type'datetime'nullabletrue)]
  32.     private $updated_at;
  33.     #[ORM\Column(type'text'nullabletrue)]
  34.     private $description;
  35.     #[ORM\ManyToMany(targetEntityProgrammeFormation::class)]
  36.     private $programmes;
  37.     #[ORM\Column(type'string'length255)]
  38.     private $titre;
  39.     #[ORM\OneToMany(targetEntitySouscription::class, mappedBy'package')]
  40.     private $souscriptions;
  41.     const TYPE_LIST_FULL = ["News","Events","Vidéo","Pack formation"],
  42.         DUREE_LIST = ['Mensuelle','Annuelle']
  43.     ;
  44.     public function __construct()
  45.     {
  46.         $this->formations = new ArrayCollection();
  47.         $this->created_at = new \DateTime();
  48.         $this->status false;
  49.         $this->programmes = new ArrayCollection();
  50.         $this->souscriptions = new ArrayCollection();
  51.     }
  52.     public function getFullType(): ?string
  53.     {
  54.         return self::TYPE_LIST_FULL[$this->type];
  55.     }
  56.     public function getFullDuree(): ?string
  57.     {
  58.         return self::DUREE_LIST[$this->duree];
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getCode(): ?string
  65.     {
  66.         return $this->code;
  67.     }
  68.     public function setCode(string $code): self
  69.     {
  70.         $this->code $code;
  71.         return $this;
  72.     }
  73.     public function getPrix(): ?float
  74.     {
  75.         return $this->prix;
  76.     }
  77.     public function setPrix(?float $prix): self
  78.     {
  79.         $this->prix $prix;
  80.         return $this;
  81.     }
  82.     public function getType(): ?int
  83.     {
  84.         return $this->type;
  85.     }
  86.     public function setType(int $type): self
  87.     {
  88.         $this->type $type;
  89.         return $this;
  90.     }
  91.     public function getDuree(): ?int
  92.     {
  93.         return $this->duree;
  94.     }
  95.     public function setDuree(?int $duree): self
  96.     {
  97.         $this->duree $duree;
  98.         return $this;
  99.     }
  100.     public function getMin(): ?int
  101.     {
  102.         return $this->min;
  103.     }
  104.     public function setMin(int $min): self
  105.     {
  106.         $this->min $min;
  107.         return $this;
  108.     }
  109.     public function getStatus(): ?bool
  110.     {
  111.         return $this->status;
  112.     }
  113.     public function setStatus(bool $status): self
  114.     {
  115.         $this->status $status;
  116.         return $this;
  117.     }
  118.     public function getUser(): ?User
  119.     {
  120.         return $this->user;
  121.     }
  122.     public function setUser(?User $user): self
  123.     {
  124.         $this->user $user;
  125.         return $this;
  126.     }
  127.     public function getCreatedAt(): ?\DateTimeInterface
  128.     {
  129.         return $this->created_at;
  130.     }
  131.     public function setCreatedAt(\DateTimeInterface $created_at): self
  132.     {
  133.         $this->created_at $created_at;
  134.         return $this;
  135.     }
  136.     public function getUpdatedAt(): ?\DateTimeInterface
  137.     {
  138.         return $this->updated_at;
  139.     }
  140.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  141.     {
  142.         $this->updated_at $updated_at;
  143.         return $this;
  144.     }
  145.     public function getDescription(): ?string
  146.     {
  147.         return $this->description;
  148.     }
  149.     public function setDescription(?string $description): self
  150.     {
  151.         $this->description $description;
  152.         return $this;
  153.     }
  154.     /**
  155.      * @return Collection|ProgrammeFormation[]
  156.      */
  157.     public function getProgrammes(): Collection
  158.     {
  159.         return $this->programmes;
  160.     }
  161.     public function addProgramme(ProgrammeFormation $programme): self
  162.     {
  163.         if (!$this->programmes->contains($programme)) {
  164.             $this->programmes[] = $programme;
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeProgramme(ProgrammeFormation $programme): self
  169.     {
  170.         if ($this->programmes->contains($programme)) {
  171.             $this->programmes->removeElement($programme);
  172.         }
  173.         return $this;
  174.     }
  175.     public function getTitre(): ?string
  176.     {
  177.         return $this->titre;
  178.     }
  179.     public function setTitre(string $titre): self
  180.     {
  181.         $this->titre $titre;
  182.         return $this;
  183.     }
  184.     /**
  185.      * @return Collection|Souscription[]
  186.      */
  187.     public function getSouscriptions(): Collection
  188.     {
  189.         return $this->souscriptions;
  190.     }
  191.     public function addSouscription(Souscription $souscription): self
  192.     {
  193.         if (!$this->souscriptions->contains($souscription)) {
  194.             $this->souscriptions[] = $souscription;
  195.             $souscription->setPackage($this);
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeSouscription(Souscription $souscription): self
  200.     {
  201.         if ($this->souscriptions->removeElement($souscription)) {
  202.             // set the owning side to null (unless already changed)
  203.             if ($souscription->getPackage() === $this) {
  204.                 $souscription->setPackage(null);
  205.             }
  206.         }
  207.         return $this;
  208.     }
  209. }