src/Entity/ForumCategory.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ForumCategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ForumCategoryRepository::class)
  9.  */
  10. class ForumCategory
  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, nullable=true)
  20.      */
  21.     private ?string $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private ?string $country;
  26.     /**
  27.      * @ORM\Column(type="string", length=25, nullable=true)
  28.      */
  29.     private ?string $countryMin;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=ForumTopic::class, mappedBy="category")
  32.      */
  33.     private $topics;
  34.     public function __construct()
  35.     {
  36.         $this->topics = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(?string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     /**
  52.      * @return Collection<int, ForumTopic>
  53.      */
  54.     public function getTopics(): Collection
  55.     {
  56.         return $this->topics;
  57.     }
  58.     public function addTopic(ForumTopic $topic): self
  59.     {
  60.         if (!$this->topics->contains($topic)) {
  61.             $this->topics[] = $topic;
  62.             $topic->setCategory($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeTopic(ForumTopic $topic): self
  67.     {
  68.         if ($this->topics->removeElement($topic)) {
  69.             // set the owning side to null (unless already changed)
  70.             if ($topic->getCategory() === $this) {
  71.                 $topic->setCategory(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     public function getCountry(): ?string
  77.     {
  78.         return $this->country;
  79.     }
  80.     public function setCountry(?string $country): self
  81.     {
  82.         $this->country $country;
  83.         return $this;
  84.     }
  85.     public function getCountryMin(): ?string
  86.     {
  87.         return $this->countryMin;
  88.     }
  89.     public function setCountryMin(?string $countryMin): self
  90.     {
  91.         $this->countryMin $countryMin;
  92.         return $this;
  93.     }
  94. }