src/Entity/Line.php line 12
<?php
namespace App\Entity;
use App\Repository\LineRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LineRepository::class)]
class Line
{
const TYPE_SIMPLE = 1;
const TYPE_WORKSHOP = 2;
const TYPE_GROUP = 3;
const TYPE_SUBSCRIBE = 4;
const ACTIVITY_TYPE_ADHESION = 'adhesion';
const ACTIVITY_TYPE_PRESENCE = 'presence';
const ACTIVITY_TYPE_SYMPOSIUM = 'symposium';
const ACTIVITY_TYPE_ATELIER = 'atelier';
const ACTIVITY_TYPE_CONFERENCE = 'conférence';
const ACTIVITY_TYPE_TABLE_RONDE = 'table_ronde';
const ACTIVITY_TYPE_COMMUNICATION = 'communication';
const ACTIVITY_TYPE_CAS_CLINIQUE = 'cas_clinique';
const ACTIVITY_TYPE_POSTER = 'poster';
const ACTIVITY_TYPE_SESSION = 'session';
const ACTIVITY_TYPE_FLASH_INFO = 'flash_info';
const ACTIVITY_TYPE_PAS_A_PAS = 'pas_a_pas';
const ACTIVITY_TYPE_MODERATOR = 'moderator';
const ACTIVITY_TYPE_FORMATION = 'formation';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $reference = null;
#[ORM\Column(length: 255)]
private ?string $theme = null;
#[ORM\Column(type: Types::SMALLINT)]
private ?int $type = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 3, nullable: true)]
private ?string $price = null; // devise dt
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2, nullable: true)]
private ?string $priceEuro = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 3, nullable: true)]
private ?string $priceResidant = null; // devise dt
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2, nullable: true)]
private ?string $priceResidantEuro = null;
#[ORM\Column(nullable: true)]
private ?int $numberOfPlaces = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $time = null;
#[ORM\ManyToOne(inversedBy: 'lineList')]
#[ORM\JoinColumn(nullable: false)]
private ?Evenement $evenement = null;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)] # minutes
private ?\DateTimeInterface $duree = null;
#[ORM\Column(type: Types::INTEGER, nullable: true)]
private ?int $position = null;
#[ORM\ManyToMany(targetEntity: Inscription::class, mappedBy: 'lineList')]
private Collection $inscriptions;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'subLines')]
#[ORM\JoinColumn(nullable: true)]
private ?self $parent = null;
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
private Collection $subLines;
// first line :: required only
#[ORM\Column(nullable: true, options: ['default' => 0])]
private ?bool $required = false;
#[ORM\Column(nullable: true)]
private ?bool $multipleChoice = null;
#[ORM\Column(nullable: true, options: ['default' => 1])]
private ?bool $showChoice = true;
#[ORM\Column(nullable: true, type: Types::BOOLEAN, options: ['default' => false])]
private ?bool $checkPresence = null;
#[ORM\Column(options: ['default' => 0])]
private ?int $numberOfPlacesReserved = 0;
#[ORM\Column(length: 255, nullable: true)]
private ?string $lieux = null;
/** @var LineParticipant[]|ArrayCollection|Collection */
#[ORM\OneToMany(targetEntity: LineParticipant::class, mappedBy: 'line', cascade: ["persist", "remove"])]
#[ORM\OrderBy(["position" => "ASC"])]
private Collection $lineParticipants;
#[ORM\ManyToMany(targetEntity: Participant::class, inversedBy: 'listOfpresentateursLines')]
#[ORM\JoinTable(name: 'line_presentateur')]
private Collection $listOfpresentateurs;
#[ORM\ManyToMany(targetEntity: Participant::class, inversedBy: 'listOfauteursLines')]
#[ORM\JoinTable(name: 'line_auteur')]
private Collection $listOfauteurs;
#[ORM\ManyToMany(targetEntity: Participant::class, inversedBy: 'listOfmoderatorsLines')]
#[ORM\JoinTable(name: 'line_moderator')]
private Collection $listOfmoderators;
#[ORM\Column(nullable: true)]
private array $listOfPresence = [];
#[ORM\Column(name: "enabled", nullable: true, options: ["default" => true])]
private ?bool $enabled = true;
#[ORM\Column(name: "selection_prealable", nullable: true, options: ["default" => true])]
private ?bool $selectionPrealable = true;
#[ORM\Column(length: 200, nullable: true)]
private ?string $activityType = null;
#[ORM\OneToMany(targetEntity: PaymentLog::class, mappedBy: 'line')]
private Collection $paymentLogs;
public function __construct()
{
$this->inscriptions = new ArrayCollection();
$this->subLines = new ArrayCollection();
$this->listOfpresentateurs = new ArrayCollection();
$this->listOfauteurs = new ArrayCollection();
$this->listOfmoderators = new ArrayCollection();
$this->lineParticipants = new ArrayCollection();
$this->paymentLogs = new ArrayCollection();
$this->required = false;
$this->position = 1;
$this->checkPresence = false;
$this->showChoice = true;
$this->enabled = true;
$this->selectionPrealable = true;
}
public function __toString(): string
{
return $this->theme;
}
public function getId(): ?int
{
return $this->id;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getTheme(): ?string
{
return $this->theme;
}
public function setTheme(string $theme): self
{
$this->theme = $theme;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
if (in_array($this->type, [self::TYPE_WORKSHOP])) {
$this->checkPresence = true;
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrice(): ?string
{
return $this->price;
}
public function setPrice(?string $price): self
{
$this->price = $price;
return $this;
}
public function getPriceEuro(): ?string
{
return $this->priceEuro;
}
public function setPriceEuro(?string $priceEuro): self
{
$this->priceEuro = $priceEuro;
return $this;
}
public function getPriceResidant(): ?string
{
return $this->priceResidant;
}
public function setPriceResidant(?string $priceResidant): self
{
$this->priceResidant = $priceResidant;
return $this;
}
public function getPriceResidantEuro(): ?string
{
return $this->priceResidantEuro;
}
public function setPriceResidantEuro(?string $priceResidantEuro): self
{
$this->priceResidantEuro = $priceResidantEuro;
return $this;
}
public function getNumberOfPlaces(): ?int
{
return $this->numberOfPlaces;
}
public function setNumberOfPlaces(?int $numberOfPlaces): self
{
$this->numberOfPlaces = $numberOfPlaces;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getTime(): ?\DateTimeInterface
{
return $this->time;
}
public function setTime(?\DateTimeInterface $time): self
{
$this->time = $time;
return $this;
}
public function getEvenement(): ?Evenement
{
return $this->evenement;
}
public function setEvenement(?Evenement $evenement): self
{
$this->evenement = $evenement;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return \DateTimeInterface|string|null
*/
public function getDuree($raw = false)
{
if (!$raw) {
return $this->duree;
}
return $this->duree ? $this->duree->format("H:i:s") : '';
}
/**
* @return int
*/
public function getDureeInMinutes()
{
$minutes = 0;
if ($this->duree) {
$minutes += 60 * intval($this->duree->format('H'));
$minutes += intval($this->duree->format('m'));
}
return $minutes;
}
/**
* @var \DateTime|string|null $duree
*/
public function setDuree($duree): self
{
if (is_string($duree)) {
$this->duree = \DateTime::createFromFormat("H:i:s", $duree);
}
if ($duree instanceof \DateTimeInterface) {
$this->duree = $duree;
}
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
/**
* @return Collection<int, Inscription>
*/
public function getInscriptions(): Collection
{
return $this->inscriptions;
}
public function addInscription(Inscription $inscription): self
{
if (!$this->inscriptions->contains($inscription)) {
$this->inscriptions->add($inscription);
$inscription->addLineList($this);
}
return $this;
}
public function removeInscription(Inscription $inscription): self
{
if ($this->inscriptions->removeElement($inscription)) {
$inscription->removeLineList($this);
}
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
if ($this->parent && $this->type && !in_array($this->type, [self::TYPE_SUBSCRIBE])) {
$this->checkPresence = true;
}
return $this;
}
/**
* @return Collection<int, self>
*/
public function getSubLines(): Collection
{
return $this->subLines;
}
public function addSubLine(self $subLine): self
{
if (!$this->subLines->contains($subLine)) {
$this->subLines->add($subLine);
$subLine->setParent($this);
}
return $this;
}
public function removeSubLine(self $subLine): self
{
if ($this->subLines->removeElement($subLine)) {
// set the owning side to null (unless already changed)
if ($subLine->getParent() === $this) {
$subLine->setParent(null);
}
}
return $this;
}
public function isMultipleChoice(): ?bool
{
return $this->multipleChoice;
}
public function setMultipleChoice(?bool $multipleChoice): self
{
$this->multipleChoice = $multipleChoice;
return $this;
}
public function getNumberOfPlacesReserved(): ?int
{
return $this->numberOfPlacesReserved;
}
public function setNumberOfPlacesReserved(int $numberOfPlacesReserved): self
{
$this->numberOfPlacesReserved = $numberOfPlacesReserved;
return $this;
}
public function getLieux(): ?string
{
return $this->lieux;
}
public function setLieux(?string $lieux): self
{
$this->lieux = $lieux;
return $this;
}
/**
* @return Collection<int, Participant>
*/
public function getListOfpresentateurs(): Collection
{
return $this->listOfpresentateurs;
}
public function addListOfpresentateur(Participant $listOfpresentateur): self
{
if (!$this->listOfpresentateurs->contains($listOfpresentateur)) {
$this->listOfpresentateurs->add($listOfpresentateur);
}
return $this;
}
public function removeListOfpresentateur(Participant $listOfpresentateur): self
{
$this->listOfpresentateurs->removeElement($listOfpresentateur);
return $this;
}
/**
* @return Collection<int, Participant>
*/
public function getListOfauteurs(): Collection
{
return $this->listOfauteurs;
}
public function addListOfauteur(Participant $listOfauteur): self
{
if (!$this->listOfauteurs->contains($listOfauteur)) {
$this->listOfauteurs->add($listOfauteur);
}
return $this;
}
public function removeListOfauteur(Participant $listOfauteur): self
{
$this->listOfauteurs->removeElement($listOfauteur);
return $this;
}
public function getListOfPresence(): array
{
if (is_null($this->listOfPresence)) {
$this->listOfPresence = [];
}
return $this->listOfPresence;
}
public function setListOfPresence(?array $listOfPresence): self
{
if (is_null($listOfPresence)) {
$listOfPresence = [];
}
if (is_null($this->listOfPresence)) {
$this->listOfPresence = [];
}
$this->listOfPresence = $listOfPresence;
return $this;
}
/**
* Get the value of checkPresence
*/
public function getCheckPresence(): ?bool
{
return $this->checkPresence;
}
/**
* Set the value of checkPresence
*
* @return self
*/
public function setCheckPresence(bool $checkPresence): self
{
$this->checkPresence = $checkPresence;
return $this;
}
/**
* Get the value of lineParticipants
* @return LineParticipant[]|ArrayCollection|Collection
*/
public function getLineParticipants(): ?Collection
{
return $this->lineParticipants;
}
/**
* Set the value of lineParticipants
*
* @return self
*/
public function setLineParticipants(?Collection $lineParticipants): self
{
$this->lineParticipants = $lineParticipants;
return $this;
}
public function addLineParticipant(LineParticipant $lineParticipant): void
{
if (!$this->lineParticipants->contains($lineParticipant)) {
if ($this) {
$lineParticipant->setLine($this);
}
$this->lineParticipants->add($lineParticipant);
}
}
public function removeLineParticipant(LineParticipant $lineParticipant): void
{
if (!$this->lineParticipants->contains($lineParticipant)) {
if ($this->lineParticipants->removeElement($lineParticipant)) {
$lineParticipant->setLine(null);
}
}
}
/**
* Get the value of showChoice
*/
public function getShowChoice()
{
return $this->showChoice;
}
/**
* Set the value of showChoice
*
* @return self
*/
public function setShowChoice($showChoice)
{
$this->showChoice = $showChoice;
return $this;
}
public function isEnabled()
{
return $this->getEnabled();
}
/**
* Get the value of enabled
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* Set the value of enabled
*
* @return self
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
return $this;
}
public function getActivityType(): ?string
{
return $this->activityType;
}
public function setActivityType(?string $activityType): self
{
$this->activityType = $activityType;
return $this;
}
/**
* Get the value of listOfmoderators
*/
public function getListOfmoderators(): ?Collection
{
return $this->listOfmoderators;
}
/**
* Set the value of listOfmoderators
*/
public function setListOfmoderators(?Collection $listOfmoderators): self
{
$this->listOfmoderators = $listOfmoderators;
return $this;
}
/**
* Get the value of selectionPrealable
*/
public function isSelectionPrealable(): ?bool
{
return $this->selectionPrealable;
}
/**
* Set the value of selectionPrealable
*/
public function setSelectionPrealable(?bool $selectionPrealable): self
{
$this->selectionPrealable = $selectionPrealable;
return $this;
}
public function isRequired(): ?bool
{
if (is_null($this->required)) {
return false;
}
return $this->required;
}
public function setRequired(?bool $required): self
{
$this->required = $required;
return $this;
}
}