src/Entity/ArticleCategory.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Traits\CreatedUpdatedTrait;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. /**
  9.  * @ORM\Table(name="v_article_category")
  10.  * @ORM\Entity(repositoryClass="App\Repository\ArticleCategoryRepository")
  11.  */
  12. class ArticleCategory
  13. {
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $title;
  24.     /**
  25.      * @var string
  26.      * @Gedmo\Slug(fields={"title"}, updatable=false)
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $slug;
  30.     /**
  31.      * @ORM\Column(type="text", nullable=true)
  32.      */
  33.     private $description;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private $enabled true;
  38.     /**
  39.      * @Gedmo\SortablePosition
  40.      * @ORM\Column(type="integer")
  41.      */
  42.     private $position;
  43.     /**
  44.      * @var ArrayCollection
  45.      * @ORM\OneToMany(targetEntity="App\Entity\Article", mappedBy="category", orphanRemoval=true)
  46.      */
  47.     private $articles;
  48.     /**
  49.      * @ORM\Column(type="string", length=20, nullable=true)
  50.      */
  51.     private $language;
  52.     public function __construct()
  53.     {
  54.         $this->articles = new ArrayCollection();
  55.     }
  56.     use CreatedUpdatedTrait;
  57.     public function __toString()
  58.     {
  59.         return (string) $this->title;
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getTitle(): ?string
  66.     {
  67.         return $this->title;
  68.     }
  69.     public function setTitle(string $title): self
  70.     {
  71.         $this->title $title;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @param string
  76.      */
  77.     public function getSlug(): ?string
  78.     {
  79.         return $this->slug;
  80.     }
  81.     /**
  82.      * @param string $slug
  83.      */
  84.     public function setSlug(string $slug): self
  85.     {
  86.         $this->slug $slug;
  87.         return $this;
  88.     }
  89.     public function getDescription(): ?string
  90.     {
  91.         return $this->description;
  92.     }
  93.     public function setDescription(?string $description): self
  94.     {
  95.         $this->description $description;
  96.         return $this;
  97.     }
  98.      /**
  99.      * @return mixed
  100.      */
  101.     public function getEnabled()
  102.     {
  103.         return $this->enabled;
  104.     }
  105.     /**
  106.      * @param mixed $enabled
  107.      */
  108.     public function setEnabled($enabled): void
  109.     {
  110.         $this->enabled $enabled;
  111.     }
  112.     /**
  113.      * @return mixed
  114.      */
  115.     public function getPosition()
  116.     {
  117.         return $this->position;
  118.     }
  119.     /**
  120.      * @param mixed $position
  121.      */
  122.     public function setPosition($position): void
  123.     {
  124.         $this->position $position;
  125.     }
  126.      /**
  127.      * @return ArrayCollection
  128.      */
  129.     public function getArticles(): Collection
  130.     {
  131.         return $this->articles;
  132.     }
  133.     /**
  134.      * @return mixed
  135.      */
  136.     public function getLanguage()
  137.     {
  138.         return $this->language;
  139.     }
  140.     /**
  141.      * @param mixed $language
  142.      */
  143.     public function setLanguage($language): void
  144.     {
  145.         $this->language $language;
  146.     }
  147. }