src/Entity/Subcategory.php line 30

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace App\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. /**
  17.  * @ORM\Entity(repositoryClass="App\Repository\SubcategoryRepository")
  18.  * @ORM\Table(name="subcategory")
  19.  *
  20.  * Defines the properties of the Tag entity to represent the subcategory tags.
  21.  *
  22.  * See https://symfony.com/doc/current/doctrine.html#creating-an-entity-class
  23.  *
  24.  * @author Yonel Ceruto <yonelceruto@gmail.com>
  25.  */
  26. class Subcategory {
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private ?int $id null;
  33.     /**
  34.      * @ORM\Column(type="string", nullable=true)
  35.      */
  36.     private ?string $name null;
  37.     /**
  38.      * @ORM\Column(type="string", nullable=true)
  39.      */
  40.     private ?string $image null;
  41.     /**
  42.      * @ORM\Column(type="string", nullable=true)
  43.      */
  44.     private ?string $description null;
  45.     /**
  46.      * @ORM\Column(type="boolean")
  47.      */
  48.     private $published;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="subcategories")
  51.      */
  52.     private $category;
  53.     /**
  54.      * @ORM\Column(type="string", nullable=true)
  55.      */
  56.     private ?string $ordre null;
  57.     /**
  58.      * @ORM\ManyToMany(targetEntity="Experience", mappedBy="subcategories")
  59.      * @ORM\JoinColumn(nullable=true)
  60.      */
  61.     private Collection $experiences;
  62.     public function __construct() {
  63.         $this->experiences = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int {
  66.         return $this->id;
  67.     }
  68.     public function getName(): ?string {
  69.         return $this->name;
  70.     }
  71.     public function getDescription(): ?string {
  72.         return $this->description;
  73.     }
  74.     public function getPublished() {
  75.         return $this->published;
  76.     }
  77.     public function getCategory() {
  78.         return $this->category;
  79.     }
  80.     public function setName(?string $name): void {
  81.         $this->name $name;
  82.     }
  83.     public function setDescription(?string $description): void {
  84.         $this->description $description;
  85.     }
  86.     public function setPublished($published): void {
  87.         $this->published $published;
  88.     }
  89.     public function setCategory($category): void {
  90.         $this->category $category;
  91.     }
  92.     public function getOrdre(): ?string {
  93.         return $this->ordre;
  94.     }
  95.     public function setOrdre(?string $ordre): void {
  96.         $this->ordre $ordre;
  97.     }
  98.     public function getImage(): ?string {
  99.         return $this->image;
  100.     }
  101.     public function setImage(?string $image): void {
  102.         $this->image $image;
  103.     }
  104.     public function addExperience(Experience $experience): void {
  105.         if (!$this->experiences->contains($experience)) {
  106.             $this->experiences[] = $experience;
  107.         }
  108.     }
  109. }