src/Entity/CourseGroup.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CourseGroupRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CourseGroupRepository::class)
  9.  */
  10. class CourseGroup
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=8192, nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\Column(type="integer")
  28.      */
  29.     private $isMain;
  30.     /**
  31.      * @ORM\Column(type="integer")
  32.      */
  33.     private $hidden;
  34.     /**
  35.      * @ORM\Column(type="string", length=4096, nullable=true)
  36.      */
  37.     private $photo;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $studentAge;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=CourseToGroup::class, mappedBy="Groups", cascade={"persist", "remove"})
  44.      */
  45.     private $courseToGroup;
  46.     public function __construct()
  47.     {
  48.         $this->courseToGroup = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getName(): ?string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function setName(string $name): self
  59.     {
  60.         $this->name $name;
  61.         return $this;
  62.     }
  63.     public function getCourseToGroup(): ?CourseToGroup
  64.     {
  65.         return $this->courseToGroup;
  66.     }
  67.     public function setCourseToGroup(CourseToGroup $courseToGroup): self
  68.     {
  69.         // set the owning side of the relation if necessary
  70.         if ($courseToGroup->getGroups() !== $this) {
  71.             $courseToGroup->setGroups($this);
  72.         }
  73.         $this->courseToGroup $courseToGroup;
  74.         return $this;
  75.     }
  76.     public function getDescription(): ?string
  77.     {
  78.         return $this->description;
  79.     }
  80.     public function setDescription(?string $description): self
  81.     {
  82.         $this->description $description;
  83.         return $this;
  84.     }
  85.     public function getIsMain(): ?int
  86.     {
  87.         return $this->isMain;
  88.     }
  89.     public function setIsMain(?string $isMain): self
  90.     {
  91.         $this->isMain $isMain;
  92.         return $this;
  93.     }
  94.     public function getHidden(): ?int
  95.     {
  96.         return $this->hidden;
  97.     }
  98.     public function setHidden(?string $hidden): self
  99.     {
  100.         $this->hidden $hidden;
  101.         return $this;
  102.     }
  103.     public function getPhoto(): ?string
  104.     {
  105.         return $this->photo;
  106.     }
  107.     public function setPhoto(?string $photo): self
  108.     {
  109.         $this->photo $photo;
  110.         return $this;
  111.     }
  112.     public function getStudentAge(): ?string
  113.     {
  114.         return $this->studentAge;
  115.     }
  116.     public function setStudentAge(?string $studentAge): self
  117.     {
  118.         $this->studentAge $studentAge;
  119.         return $this;
  120.     }
  121.     public function addCourseToGroup(CourseToGroup $courseToGroup): static
  122.     {
  123.         if (!$this->courseToGroup->contains($courseToGroup)) {
  124.             $this->courseToGroup->add($courseToGroup);
  125.             $courseToGroup->setGroups($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeCourseToGroup(CourseToGroup $courseToGroup): static
  130.     {
  131.         if ($this->courseToGroup->removeElement($courseToGroup)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($courseToGroup->getGroups() === $this) {
  134.                 $courseToGroup->setGroups(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139. }