<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
*/
class Category
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Subject", mappedBy="category")
*/
private $subjects;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Teacher", mappedBy="categories")
*/
private $teachers;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Plan", mappedBy="category")
*/
private $plans;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SubscriptionOrder", mappedBy="category")
*/
private $subscriptionOrders;
/**
* @ORM\Column(type="string", length=50)
*/
private $nameEn;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Ticket", mappedBy="category")
*/
private $tickets;
public function __construct()
{
$this->subjects = new ArrayCollection();
$this->teachers = new ArrayCollection();
$this->programs = new ArrayCollection();
$this->plans = new ArrayCollection();
$this->subscriptionOrders = new ArrayCollection();
$this->tickets = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Subject[]
*/
public function getSubjects(): Collection
{
return $this->subjects;
}
public function addSubject(Subject $subject): self
{
if (!$this->subjects->contains($subject)) {
$this->subjects[] = $subject;
$subject->setCategory($this);
}
return $this;
}
public function removeSubject(Subject $subject): self
{
if ($this->subjects->contains($subject)) {
$this->subjects->removeElement($subject);
// set the owning side to null (unless already changed)
if ($subject->getCategory() === $this) {
$subject->setCategory(null);
}
}
return $this;
}
public function __toString()
{
return $this->getName();
}
/**
* @return Collection|Teacher[]
*/
public function getTeachers(): Collection
{
return $this->teachers;
}
public function addTeacher(Teacher $teacher): self
{
if (!$this->teachers->contains($teacher)) {
$this->teachers[] = $teacher;
$teacher->addCategory($this);
}
return $this;
}
public function removeTeacher(Teacher $teacher): self
{
if ($this->teachers->contains($teacher)) {
$this->teachers->removeElement($teacher);
$teacher->removeCategory($this);
}
return $this;
}
/**
* @return Collection|Plan[]
*/
public function getPlans(): Collection
{
return $this->plans;
}
public function addPlan(Plan $plan): self
{
if (!$this->plans->contains($plan)) {
$this->plans[] = $plan;
$plan->setCategory($this);
}
return $this;
}
public function removePlan(Plan $plan): self
{
if ($this->plans->contains($plan)) {
$this->plans->removeElement($plan);
// set the owning side to null (unless already changed)
if ($plan->getCategory() === $this) {
$plan->setCategory(null);
}
}
return $this;
}
/**
* @return Collection|SubscriptionOrder[]
*/
public function getSubscriptionOrders(): Collection
{
return $this->subscriptionOrders;
}
public function addSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if (!$this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders[] = $subscriptionOrder;
$subscriptionOrder->setCategory($this);
}
return $this;
}
public function removeSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if ($this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders->removeElement($subscriptionOrder);
// set the owning side to null (unless already changed)
if ($subscriptionOrder->getCategory() === $this) {
$subscriptionOrder->setCategory(null);
}
}
return $this;
}
public function getNameEn(): ?string
{
return $this->nameEn;
}
public function setNameEn(?string $nameEn): self
{
$this->nameEn = $nameEn;
return $this;
}
/**
* @return Collection|Ticket[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}
public function addTicket(Ticket $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setCategory($this);
}
return $this;
}
public function removeTicket(Ticket $ticket): self
{
if ($this->tickets->contains($ticket)) {
$this->tickets->removeElement($ticket);
// set the owning side to null (unless already changed)
if ($ticket->getCategory() === $this) {
$ticket->setCategory(null);
}
}
return $this;
}
}