src/Entity/EventAbstract.php line 12
<?phpnamespace App\Entity;use App\Repository\EventAbstractRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: EventAbstractRepository::class)]class EventAbstract{//decisionsconst COMMUNICATION_ORALE = 1;const COMMUNICATION_ECRITE = 2;const POSTER_COMMENTE = 3;const POSTER_ELECTRONIQUE = 4;//typesconst COMMUNICATION = 1;const POSTER = 2;//statutconst ACCEPTED = 1;const REFUSED = 2;const PENDING = 3;const DRAFT = 4;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::SMALLINT, nullable: true)]private ?int $type = null;#[ORM\Column(length: 255, nullable: true)]private ?string $title = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $intro = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $objectifs = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $methodes = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $result = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $conclusion = null;#[ORM\Column(type: Types::SMALLINT, nullable: true)]private ?int $status = null;#[ORM\Column(nullable: true)]private ?int $updated_by = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $created_at = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $updated_at = null;#[ORM\ManyToOne(inversedBy: 'eventAbstracts')]#[ORM\JoinColumn(nullable: true)]private ?Evenement $event = null;# [ORM\ManyToOne(targetEntity: Theme::class, inversedBy: 'eventAbstract')]private ?Theme $theme = null;#[ORM\ManyToMany(targetEntity: Theme::class, inversedBy: 'eventAbstracts')]#[ORM\JoinTable(name: "event_abstract_themes")]private Collection $themes;#[ORM\ManyToOne(targetEntity: AbstractAuthors::class, inversedBy: 'eventAbstract')]# [ORM\JoinTable(name: "event_abstract_responsible")]private ?AbstractAuthors $responsable = null;#[ORM\ManyToMany(targetEntity: AbstractAuthors::class, inversedBy: 'eventAbstractsAsPresenter', cascade: ["persist", "remove"])]#[ORM\JoinTable(name: "event_abstract_as_presenters")]private Collection $presenters;#[ORM\ManyToMany(targetEntity: AbstractAuthors::class, inversedBy: 'eventAbstractsAsAuthors', cascade: ["persist", "remove"])]#[ORM\JoinTable(name: "event_abstract_as_authors")]private Collection $authors;#[ORM\Column(length: 255, nullable: true)]private ?string $reference = null;#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'eventAbstracts')]#[ORM\JoinColumn(nullable: true)]private ?User $user = null;#[ORM\Column(length: 255, nullable: true)]private ?int $decision = null;public function __construct(){$this->themes = new ArrayCollection();$this->presenters = new ArrayCollection();$this->created_at = new \DateTime();$this->status = self::DRAFT;$this->authors = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getType(): ?int{return $this->type;}public function setType(?int $type): static{$this->type = $type;return $this;}public function getTitle(): ?string{return $this->title;}public function setTitle(?string $title): static{$this->title = $title;return $this;}public function getIntro(): ?string{return $this->intro;}public function setIntro(?string $intro): static{$this->intro = $intro;return $this;}public function getObjectifs(): ?string{return $this->objectifs;}public function setObjectifs(?string $objectifs): static{$this->objectifs = $objectifs;return $this;}public function getMethodes(): ?string{return $this->methodes;}public function setMethodes(?string $methodes): static{$this->methodes = $methodes;return $this;}public function getResult(): ?string{return $this->result;}public function setResult(?string $result): static{$this->result = $result;return $this;}public function getConclusion(): ?string{return $this->conclusion;}public function setConclusion(?string $conclusion): static{$this->conclusion = $conclusion;return $this;}public function getStatus(): ?int{return $this->status;}public function setStatus(?int $status): static{$this->status = $status;return $this;}public function getUpdatedBy(): ?int{return $this->updated_by;}public function setUpdatedBy(?int $updated_by): static{$this->updated_by = $updated_by;return $this;}public function getCreatedAt(): ?\DateTimeInterface{return $this->created_at;}public function setCreatedAt(?\DateTimeInterface $created_at): static{$this->created_at = $created_at;return $this;}public function getUpdatedAt(): ?\DateTimeInterface{return $this->updated_at;}public function setUpdatedAt(?\DateTimeInterface $updated_at): static{$this->updated_at = $updated_at;return $this;}public function getEvenement(): ?Evenement{return $this->event;}public function setEvenement(?Evenement $event): static{$this->event = $event;return $this;}/*** @deprecated*/public function getEvent(): ?Evenement{return $this->event;}/*** @deprecated*/public function setEvent(?Evenement $event): static{$this->event = $event;return $this;}public function getTheme(): ?Theme{// if (empty($this->theme) && !$this->themes->isEmpty()) {// return $this->themes->first();// }return $this->theme;}public function setTheme(?Theme $theme): static{$this->theme = $theme;return $this;}public function getThemes(): Collection{return $this->themes;}public function addTheme(?Theme $theme): static{if (!$this->themes->contains($theme)) {$this->themes->add($theme);$theme->addEventAbstract($this);}return $this;}public function removeTheme(?Theme $theme): static{if ($this->themes->removeElement($theme)) {$theme->removeEventAbstract($this);}return $this;}public function getResponsable(): ?AbstractAuthors{return $this->responsable;}public function setResponsable(?AbstractAuthors $responsable): static{$this->responsable = $responsable;return $this;}/*** @return Collection<int, AbstractAuthors>*/public function getPresenters(): Collection{return $this->presenters;}public function addPresenter(AbstractAuthors $presenter): static{if (!$this->presenters->contains($presenter)) {$this->presenters->add($presenter);}return $this;}public function removePresenter(AbstractAuthors $presenter): static{$this->presenters->removeElement($presenter);return $this;}public function getReference(): ?string{return $this->reference;}public function setReference(?string $reference): static{$this->reference = $reference;return $this;}/*** Cette fonction sert à générer une référence pour un abstract selon son type* @return string*/public function generateReference(): string{//get original occurrence$compteurs = $this->getEvenement()->getCompteurs();if (!isset($compteurs[$this->decision])) {$compteurs[$this->decision] = 1;}$occ = $compteurs[$this->decision];//update compteurs in event$occ++;$this->getEvenement()->modifyCompteurs($this->decision, $occ);//generate the referencereturn match ($this->decision) {self::COMMUNICATION_ORALE => "CO" . $occ,self::COMMUNICATION_ECRITE => "CE" . $occ,self::POSTER_COMMENTE => "PC" . $occ,self::POSTER_ELECTRONIQUE => "PE" . $occ,default => "PO" . $occ, // self::POSTER};}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): static{$this->user = $user;return $this;}/*** @return Collection<int, AbstractAuthors>*/public function getAuthors(): ?Collection{return $this->authors;}public function addAuthor(AbstractAuthors $author): void{if (!$this->authors->contains($author)) {$this->authors->add($author);}}public function removeAuthor(AbstractAuthors $author): void{if ($this->presenters->contains($author)) {$this->removePresenter($author);}if ($this->responsable == $author) {$this->setResponsable(null);}$this->authors->removeElement($author);}public function getDecision(): ?int{return $this->decision;}public function setDecision(?int $decision): static{$this->decision = $decision;return $this;}public function getDecisionName(): string{switch ($this->decision) {case self::COMMUNICATION_ORALE:$dec = "Communication Orale";break;case self::COMMUNICATION_ECRITE:$dec = "Communication Ecrite";break;case self::POSTER_COMMENTE:$dec = "Poster Commenté";break;case self::POSTER_ELECTRONIQUE:$dec = "Poster Electronique";break;default:$dec = "";break;}return $dec;}}