src/Entity/Package.php line 13

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. /**
  8.  * @ORM\Entity(repositoryClass=PackageRepository::class)
  9.  */
  10. class Package
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=50)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="text", nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\Column(type="boolean", options={"default" : 1})
  28.      */
  29.     private $status 1;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Participant::class, mappedBy="package", orphanRemoval=true)
  32.      */
  33.     private $participants;
  34.     /**
  35.      * @ORM\Column(type="string", length=50)
  36.      */
  37.     private $secretCode;
  38.     public function __construct()
  39.     {
  40.         $this->participants = new ArrayCollection();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): self
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getDescription(): ?string
  56.     {
  57.         return $this->description;
  58.     }
  59.     public function setDescription(?string $description): self
  60.     {
  61.         $this->description $description;
  62.         return $this;
  63.     }
  64.     public function getStatus(): ?bool
  65.     {
  66.         return $this->status;
  67.     }
  68.     public function setStatus(bool $status): self
  69.     {
  70.         $this->status $status;
  71.         return $this;
  72.     }
  73.     public function __toString()
  74.     {
  75.         return $this->name;
  76.     }
  77.     /**
  78.      * @return Collection<int, Participant>
  79.      */
  80.     public function getParticipants(): Collection
  81.     {
  82.         return $this->participants;
  83.     }
  84.     public function addParticipant(Participant $participant): self
  85.     {
  86.         if (!$this->participants->contains($participant)) {
  87.             $this->participants[] = $participant;
  88.             $participant->setPackage($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeParticipant(Participant $participant): self
  93.     {
  94.         if ($this->participants->removeElement($participant)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($participant->getPackage() === $this) {
  97.                 $participant->setPackage(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     public function getSecretCode(): ?string
  103.     {
  104.         return $this->secretCode;
  105.     }
  106.     public function setSecretCode(string $secretCode): self
  107.     {
  108.         $this->secretCode $secretCode;
  109.         return $this;
  110.     }
  111. }