vendor/score/cms/src/Entity/Article/ArticleCategory.php line 15

Open in your IDE?
  1. <?php
  2. namespace Score\CmsBundle\Entity\Article;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Score\BaseBundle\Entity\BaseEntity;
  7. /**
  8.  * @ORM\Entity()
  9.  * @ORM\Table(name="cms_article_category")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class ArticleCategory extends BaseEntity {
  13.     /**
  14.      * @ORM\Column(name="a_name", type="string", length=1000)
  15.      */
  16.     protected $name;
  17.     /**
  18.      * @ORM\Column(name="a_public", type="boolean", nullable=true)
  19.      */
  20.     protected $public;
  21.     /**
  22.      * @ORM\Column(name="a_seo_name", type="string", length=1000, nullable=true)
  23.      */
  24.     protected $seoName;
  25.     /**
  26.      * @ORM\ManyToMany(targetEntity=Article::class, mappedBy="articleCategories")
  27.      */
  28.     protected $articles;
  29.     public function __construct() {
  30.         $this->articles = new ArrayCollection();
  31.     }
  32.     public function __toString() {
  33.         return $this->name;
  34.     }
  35.     public function getName(): ?string {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): self {
  39.         $this->name = $name;
  40.         return $this;
  41.     }
  42.     public function getPublic(): ?bool {
  43.         return $this->public;
  44.     }
  45.     public function setPublic(?bool $public): self {
  46.         $this->public = $public;
  47.         return $this;
  48.     }
  49.     public function getSeoName(): ?string {
  50.         return $this->seoName;
  51.     }
  52.     public function setSeoName(?string $seoName): self {
  53.         $this->seoName = $seoName;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection<int, Article>
  58.      */
  59.     public function getArticles(): Collection {
  60.         return $this->articles;
  61.     }
  62.     public function addArticle(Article $article): self {
  63.         if (!$this->articles->contains($article)) {
  64.             $this->articles[] = $article;
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeArticle(Article $article): self {
  69.         $this->articles->removeElement($article);
  70.         return $this;
  71.     }
  72. }