src/Entity/Line.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LineRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassLineRepository::class)]
  9. class Line
  10. {
  11.     const TYPE_SIMPLE 1;
  12.     const TYPE_WORKSHOP 2;
  13.     const TYPE_GROUP 3;
  14.     const TYPE_SUBSCRIBE 4;
  15.     const ACTIVITY_TYPE_ADHESION 'adhesion';
  16.     const ACTIVITY_TYPE_PRESENCE 'presence';
  17.     const ACTIVITY_TYPE_SYMPOSIUM 'symposium';
  18.     const ACTIVITY_TYPE_ATELIER 'atelier';
  19.     const ACTIVITY_TYPE_CONFERENCE 'conférence';
  20.     const ACTIVITY_TYPE_TABLE_RONDE 'table_ronde';
  21.     const ACTIVITY_TYPE_COMMUNICATION 'communication';
  22.     const ACTIVITY_TYPE_CAS_CLINIQUE 'cas_clinique';
  23.     const ACTIVITY_TYPE_POSTER 'poster';
  24.     const ACTIVITY_TYPE_SESSION 'session';
  25.     const ACTIVITY_TYPE_FLASH_INFO 'flash_info';
  26.     const ACTIVITY_TYPE_PAS_A_PAS 'pas_a_pas';
  27.     const ACTIVITY_TYPE_MODERATOR 'moderator';
  28.     const ACTIVITY_TYPE_FORMATION 'formation';
  29.     #[ORM\Id]
  30.     #[ORM\GeneratedValue]
  31.     #[ORM\Column]
  32.     private ?int $id null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $reference null;
  35.     #[ORM\Column(length255)]
  36.     private ?string $theme null;
  37.     #[ORM\Column(typeTypes::SMALLINT)]
  38.     private ?int $type null;
  39.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  40.     private ?string $description null;
  41.     #[ORM\Column(typeTypes::DECIMALprecision10scale3nullabletrue)]
  42.     private ?string $price null// devise dt
  43.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  44.     private ?string $priceEuro null;
  45.     #[ORM\Column(typeTypes::DECIMALprecision10scale3nullabletrue)]
  46.     private ?string $priceResidant null// devise dt
  47.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  48.     private ?string $priceResidantEuro null;
  49.     #[ORM\Column(nullabletrue)]
  50.     private ?int $numberOfPlaces null;
  51.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  52.     private ?\DateTimeInterface $date null;
  53.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $time null;
  55.     #[ORM\ManyToOne(inversedBy'lineList')]
  56.     #[ORM\JoinColumn(nullablefalse)]
  57.     private ?Evenement $evenement null;
  58.     #[ORM\Column(type'datetime')]
  59.     private $createdAt;
  60.     #[ORM\Column(type'datetime'nullabletrue)]
  61.     private $updatedAt;
  62.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)] # minutes
  63.     private ?\DateTimeInterface $duree null;
  64.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  65.     private ?int $position null;
  66.     #[ORM\ManyToMany(targetEntityInscription::class, mappedBy'lineList')]
  67.     private Collection $inscriptions;
  68.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'subLines')]
  69.     #[ORM\JoinColumn(nullabletrue)]
  70.     private ?self $parent null;
  71.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class)]
  72.     private Collection $subLines;
  73.     // first line :: required only
  74.     #[ORM\Column(nullabletrueoptions: ['default' => 0])]
  75.     private ?bool $required false;
  76.     #[ORM\Column(nullabletrue)]
  77.     private ?bool $multipleChoice null;
  78.     #[ORM\Column(nullabletrueoptions: ['default' => 1])]
  79.     private ?bool $showChoice true;
  80.     #[ORM\Column(nullabletruetypeTypes::BOOLEANoptions: ['default' => false])]
  81.     private ?bool $checkPresence null;
  82.     #[ORM\Column(options: ['default' => 0])]
  83.     private ?int $numberOfPlacesReserved 0;
  84.     #[ORM\Column(length255nullabletrue)]
  85.     private ?string $lieux null;
  86.     /** @var LineParticipant[]|ArrayCollection|Collection */
  87.     #[ORM\OneToMany(targetEntityLineParticipant::class, mappedBy'line'cascade: ["persist""remove"])]
  88.     #[ORM\OrderBy(["position" => "ASC"])]
  89.     private Collection $lineParticipants;
  90.     #[ORM\ManyToMany(targetEntityParticipant::class, inversedBy'listOfpresentateursLines')]
  91.     #[ORM\JoinTable(name'line_presentateur')]
  92.     private Collection $listOfpresentateurs;
  93.     #[ORM\ManyToMany(targetEntityParticipant::class, inversedBy'listOfauteursLines')]
  94.     #[ORM\JoinTable(name'line_auteur')]
  95.     private Collection $listOfauteurs;
  96.     #[ORM\ManyToMany(targetEntityParticipant::class, inversedBy'listOfmoderatorsLines')]
  97.     #[ORM\JoinTable(name'line_moderator')]
  98.     private Collection $listOfmoderators;
  99.     #[ORM\Column(nullabletrue)]
  100.     private array $listOfPresence = [];
  101.     #[ORM\Column(name"enabled"nullabletrueoptions: ["default" => true])]
  102.     private ?bool $enabled true;
  103.     #[ORM\Column(name"selection_prealable"nullabletrueoptions: ["default" => true])]
  104.     private ?bool $selectionPrealable true;
  105.     #[ORM\Column(length200nullabletrue)]
  106.     private ?string $activityType null;
  107.     #[ORM\OneToMany(targetEntityPaymentLog::class, mappedBy'line')]
  108.     private Collection $paymentLogs;
  109.     public function __construct()
  110.     {
  111.         $this->inscriptions = new ArrayCollection();
  112.         $this->subLines = new ArrayCollection();
  113.         $this->listOfpresentateurs = new ArrayCollection();
  114.         $this->listOfauteurs = new ArrayCollection();
  115.         $this->listOfmoderators = new ArrayCollection();
  116.         $this->lineParticipants = new ArrayCollection();
  117.         $this->paymentLogs = new ArrayCollection();
  118.         $this->required false;
  119.         $this->position 1;
  120.         $this->checkPresence false;
  121.         $this->showChoice true;
  122.         $this->enabled true;
  123.         $this->selectionPrealable true;
  124.     }
  125.     public function __toString(): string
  126.     {
  127.         return $this->theme;
  128.     }
  129.     public function getId(): ?int
  130.     {
  131.         return $this->id;
  132.     }
  133.     public function getReference(): ?string
  134.     {
  135.         return $this->reference;
  136.     }
  137.     public function setReference(string $reference): self
  138.     {
  139.         $this->reference $reference;
  140.         return $this;
  141.     }
  142.     public function getTheme(): ?string
  143.     {
  144.         return $this->theme;
  145.     }
  146.     public function setTheme(string $theme): self
  147.     {
  148.         $this->theme $theme;
  149.         return $this;
  150.     }
  151.     public function getType(): ?int
  152.     {
  153.         return $this->type;
  154.     }
  155.     public function setType(int $type): self
  156.     {
  157.         $this->type $type;
  158.         if (in_array($this->type, [self::TYPE_WORKSHOP])) {
  159.             $this->checkPresence true;
  160.         }
  161.         return $this;
  162.     }
  163.     public function getDescription(): ?string
  164.     {
  165.         return $this->description;
  166.     }
  167.     public function setDescription(?string $description): self
  168.     {
  169.         $this->description $description;
  170.         return $this;
  171.     }
  172.     public function getPrice(): ?string
  173.     {
  174.         return $this->price;
  175.     }
  176.     public function setPrice(?string $price): self
  177.     {
  178.         $this->price $price;
  179.         return $this;
  180.     }
  181.     public function getPriceEuro(): ?string
  182.     {
  183.         return $this->priceEuro;
  184.     }
  185.     public function setPriceEuro(?string $priceEuro): self
  186.     {
  187.         $this->priceEuro $priceEuro;
  188.         return $this;
  189.     }
  190.     public function getPriceResidant(): ?string
  191.     {
  192.         return $this->priceResidant;
  193.     }
  194.     public function setPriceResidant(?string $priceResidant): self
  195.     {
  196.         $this->priceResidant $priceResidant;
  197.         return $this;
  198.     }
  199.     public function getPriceResidantEuro(): ?string
  200.     {
  201.         return $this->priceResidantEuro;
  202.     }
  203.     public function setPriceResidantEuro(?string $priceResidantEuro): self
  204.     {
  205.         $this->priceResidantEuro $priceResidantEuro;
  206.         return $this;
  207.     }
  208.     public function getNumberOfPlaces(): ?int
  209.     {
  210.         return $this->numberOfPlaces;
  211.     }
  212.     public function setNumberOfPlaces(?int $numberOfPlaces): self
  213.     {
  214.         $this->numberOfPlaces $numberOfPlaces;
  215.         return $this;
  216.     }
  217.     public function getDate(): ?\DateTimeInterface
  218.     {
  219.         return $this->date;
  220.     }
  221.     public function setDate(?\DateTimeInterface $date): self
  222.     {
  223.         $this->date $date;
  224.         return $this;
  225.     }
  226.     public function getTime(): ?\DateTimeInterface
  227.     {
  228.         return $this->time;
  229.     }
  230.     public function setTime(?\DateTimeInterface $time): self
  231.     {
  232.         $this->time $time;
  233.         return $this;
  234.     }
  235.     public function getEvenement(): ?Evenement
  236.     {
  237.         return $this->evenement;
  238.     }
  239.     public function setEvenement(?Evenement $evenement): self
  240.     {
  241.         $this->evenement $evenement;
  242.         return $this;
  243.     }
  244.     public function getCreatedAt(): ?\DateTimeInterface
  245.     {
  246.         return $this->createdAt;
  247.     }
  248.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  249.     {
  250.         $this->createdAt $createdAt;
  251.         return $this;
  252.     }
  253.     public function getUpdatedAt(): ?\DateTimeInterface
  254.     {
  255.         return $this->updatedAt;
  256.     }
  257.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  258.     {
  259.         $this->updatedAt $updatedAt;
  260.         return $this;
  261.     }
  262.     /**
  263.      * @return \DateTimeInterface|string|null
  264.      */
  265.     public function getDuree($raw false)
  266.     {
  267.         if (!$raw) {
  268.             return $this->duree;
  269.         }
  270.         return $this->duree $this->duree->format("H:i:s") : '';
  271.     }
  272.     /**
  273.      * @return int
  274.      */
  275.     public function getDureeInMinutes()
  276.     {
  277.         $minutes 0;
  278.         if ($this->duree) {
  279.             $minutes += 60 intval($this->duree->format('H'));
  280.             $minutes += intval($this->duree->format('m'));
  281.         }
  282.         return $minutes;
  283.     }
  284.     /**
  285.      * @var \DateTime|string|null $duree
  286.      */
  287.     public function setDuree($duree): self
  288.     {
  289.         if (is_string($duree)) {
  290.             $this->duree \DateTime::createFromFormat("H:i:s"$duree);
  291.         }
  292.         if ($duree instanceof \DateTimeInterface) {
  293.             $this->duree $duree;
  294.         }
  295.         return $this;
  296.     }
  297.     public function getPosition(): ?int
  298.     {
  299.         return $this->position;
  300.     }
  301.     public function setPosition(int $position): self
  302.     {
  303.         $this->position $position;
  304.         return $this;
  305.     }
  306.     /**
  307.      * @return Collection<int, Inscription>
  308.      */
  309.     public function getInscriptions(): Collection
  310.     {
  311.         return $this->inscriptions;
  312.     }
  313.     public function addInscription(Inscription $inscription): self
  314.     {
  315.         if (!$this->inscriptions->contains($inscription)) {
  316.             $this->inscriptions->add($inscription);
  317.             $inscription->addLineList($this);
  318.         }
  319.         return $this;
  320.     }
  321.     public function removeInscription(Inscription $inscription): self
  322.     {
  323.         if ($this->inscriptions->removeElement($inscription)) {
  324.             $inscription->removeLineList($this);
  325.         }
  326.         return $this;
  327.     }
  328.     public function getParent(): ?self
  329.     {
  330.         return $this->parent;
  331.     }
  332.     public function setParent(?self $parent): self
  333.     {
  334.         $this->parent $parent;
  335.         if ($this->parent && $this->type && !in_array($this->type, [self::TYPE_SUBSCRIBE])) {
  336.             $this->checkPresence true;
  337.         }
  338.         return $this;
  339.     }
  340.     /**
  341.      * @return Collection<int, self>
  342.      */
  343.     public function getSubLines(): Collection
  344.     {
  345.         return $this->subLines;
  346.     }
  347.     public function addSubLine(self $subLine): self
  348.     {
  349.         if (!$this->subLines->contains($subLine)) {
  350.             $this->subLines->add($subLine);
  351.             $subLine->setParent($this);
  352.         }
  353.         return $this;
  354.     }
  355.     public function removeSubLine(self $subLine): self
  356.     {
  357.         if ($this->subLines->removeElement($subLine)) {
  358.             // set the owning side to null (unless already changed)
  359.             if ($subLine->getParent() === $this) {
  360.                 $subLine->setParent(null);
  361.             }
  362.         }
  363.         return $this;
  364.     }
  365.     public function isMultipleChoice(): ?bool
  366.     {
  367.         return $this->multipleChoice;
  368.     }
  369.     public function setMultipleChoice(?bool $multipleChoice): self
  370.     {
  371.         $this->multipleChoice $multipleChoice;
  372.         return $this;
  373.     }
  374.     public function getNumberOfPlacesReserved(): ?int
  375.     {
  376.         return $this->numberOfPlacesReserved;
  377.     }
  378.     public function setNumberOfPlacesReserved(int $numberOfPlacesReserved): self
  379.     {
  380.         $this->numberOfPlacesReserved $numberOfPlacesReserved;
  381.         return $this;
  382.     }
  383.     public function getLieux(): ?string
  384.     {
  385.         return $this->lieux;
  386.     }
  387.     public function setLieux(?string $lieux): self
  388.     {
  389.         $this->lieux $lieux;
  390.         return $this;
  391.     }
  392.     /**
  393.      * @return Collection<int, Participant>
  394.      */
  395.     public function getListOfpresentateurs(): Collection
  396.     {
  397.         return $this->listOfpresentateurs;
  398.     }
  399.     public function addListOfpresentateur(Participant $listOfpresentateur): self
  400.     {
  401.         if (!$this->listOfpresentateurs->contains($listOfpresentateur)) {
  402.             $this->listOfpresentateurs->add($listOfpresentateur);
  403.         }
  404.         return $this;
  405.     }
  406.     public function removeListOfpresentateur(Participant $listOfpresentateur): self
  407.     {
  408.         $this->listOfpresentateurs->removeElement($listOfpresentateur);
  409.         return $this;
  410.     }
  411.     /**
  412.      * @return Collection<int, Participant>
  413.      */
  414.     public function getListOfauteurs(): Collection
  415.     {
  416.         return $this->listOfauteurs;
  417.     }
  418.     public function addListOfauteur(Participant $listOfauteur): self
  419.     {
  420.         if (!$this->listOfauteurs->contains($listOfauteur)) {
  421.             $this->listOfauteurs->add($listOfauteur);
  422.         }
  423.         return $this;
  424.     }
  425.     public function removeListOfauteur(Participant $listOfauteur): self
  426.     {
  427.         $this->listOfauteurs->removeElement($listOfauteur);
  428.         return $this;
  429.     }
  430.     public function getListOfPresence(): array
  431.     {
  432.         if (is_null($this->listOfPresence)) {
  433.             $this->listOfPresence = [];
  434.         }
  435.         return $this->listOfPresence;
  436.     }
  437.     public function setListOfPresence(?array $listOfPresence): self
  438.     {
  439.         if (is_null($listOfPresence)) {
  440.             $listOfPresence = [];
  441.         }
  442.         if (is_null($this->listOfPresence)) {
  443.             $this->listOfPresence = [];
  444.         }
  445.         $this->listOfPresence $listOfPresence;
  446.         return $this;
  447.     }
  448.     /**
  449.      * Get the value of checkPresence
  450.      */
  451.     public function getCheckPresence(): ?bool
  452.     {
  453.         return $this->checkPresence;
  454.     }
  455.     /**
  456.      * Set the value of checkPresence
  457.      *
  458.      * @return  self
  459.      */
  460.     public function setCheckPresence(bool $checkPresence): self
  461.     {
  462.         $this->checkPresence $checkPresence;
  463.         return $this;
  464.     }
  465.     /**
  466.      * Get the value of lineParticipants
  467.      * @return LineParticipant[]|ArrayCollection|Collection
  468.      */
  469.     public function getLineParticipants(): ?Collection
  470.     {
  471.         return $this->lineParticipants;
  472.     }
  473.     /**
  474.      * Set the value of lineParticipants
  475.      *
  476.      * @return  self
  477.      */
  478.     public function setLineParticipants(?Collection $lineParticipants): self
  479.     {
  480.         $this->lineParticipants $lineParticipants;
  481.         return $this;
  482.     }
  483.     public function addLineParticipant(LineParticipant $lineParticipant): void
  484.     {
  485.         if (!$this->lineParticipants->contains($lineParticipant)) {
  486.             if ($this) {
  487.                 $lineParticipant->setLine($this);
  488.             }
  489.             $this->lineParticipants->add($lineParticipant);
  490.         }
  491.     }
  492.     public function removeLineParticipant(LineParticipant $lineParticipant): void
  493.     {
  494.         if (!$this->lineParticipants->contains($lineParticipant)) {
  495.             if ($this->lineParticipants->removeElement($lineParticipant)) {
  496.                 $lineParticipant->setLine(null);
  497.             }
  498.         }
  499.     }
  500.     /**
  501.      * Get the value of showChoice
  502.      */
  503.     public function getShowChoice()
  504.     {
  505.         return $this->showChoice;
  506.     }
  507.     /**
  508.      * Set the value of showChoice
  509.      *
  510.      * @return  self
  511.      */
  512.     public function setShowChoice($showChoice)
  513.     {
  514.         $this->showChoice $showChoice;
  515.         return $this;
  516.     }
  517.     public function isEnabled()
  518.     {
  519.         return $this->getEnabled();
  520.     }
  521.     /**
  522.      * Get the value of enabled
  523.      */
  524.     public function getEnabled()
  525.     {
  526.         return $this->enabled;
  527.     }
  528.     /**
  529.      * Set the value of enabled
  530.      *
  531.      * @return  self
  532.      */
  533.     public function setEnabled($enabled)
  534.     {
  535.         $this->enabled $enabled;
  536.         return $this;
  537.     }
  538.     public function getActivityType(): ?string
  539.     {
  540.         return $this->activityType;
  541.     }
  542.     public function setActivityType(?string $activityType): self
  543.     {
  544.         $this->activityType $activityType;
  545.         return $this;
  546.     }
  547.     /**
  548.      * Get the value of listOfmoderators
  549.      */
  550.     public function getListOfmoderators(): ?Collection
  551.     {
  552.         return $this->listOfmoderators;
  553.     }
  554.     /**
  555.      * Set the value of listOfmoderators
  556.      */
  557.     public function setListOfmoderators(?Collection $listOfmoderators): self
  558.     {
  559.         $this->listOfmoderators $listOfmoderators;
  560.         return $this;
  561.     }
  562.     /**
  563.      * Get the value of selectionPrealable
  564.      */
  565.     public function isSelectionPrealable(): ?bool
  566.     {
  567.         return $this->selectionPrealable;
  568.     }
  569.     /**
  570.      * Set the value of selectionPrealable
  571.      */
  572.     public function setSelectionPrealable(?bool $selectionPrealable): self
  573.     {
  574.         $this->selectionPrealable $selectionPrealable;
  575.         return $this;
  576.     }
  577.     public function isRequired(): ?bool
  578.     {
  579.         if (is_null($this->required)) {
  580.             return false;
  581.         }
  582.         return $this->required;
  583.     }
  584.     public function setRequired(?bool $required): self
  585.     {
  586.         $this->required $required;
  587.         return $this;
  588.     }
  589. }