src/Entity/Articles.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ArticlesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassArticlesRepository::class)]
  8. class Articles
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $description;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $icon;
  20.     #[ORM\Column(type'integer')]
  21.     private $articleCount;
  22.     #[ORM\Column(type'datetime')]
  23.     private $modified;
  24.     #[ORM\Column(type'datetime')]
  25.     private $created;
  26.     #[ORM\OneToMany(targetEntityArticleDetails::class, mappedBy'article')]
  27.     private $articleDetails;
  28.     #[ORM\ManyToOne(targetEntityPages::class, inversedBy'articles')]
  29.     private $page;
  30.     #[ORM\Column(type'integer')]
  31.     private $isMulti;
  32.     public function __construct()
  33.     {
  34.         $this->setModified(new \DateTime());
  35.         if ($this->getCreated() == null) {
  36.             $this->setCreated(new \DateTime());
  37.         }
  38.         $this->articleDetails = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(?string $description): self
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     public function getIcon(): ?string
  63.     {
  64.         return $this->icon;
  65.     }
  66.     public function setIcon(?string $icon): self
  67.     {
  68.         $this->icon $icon;
  69.         return $this;
  70.     }
  71.     public function getArticleCount(): ?int
  72.     {
  73.         return $this->articleCount;
  74.     }
  75.     public function setArticleCount(int $articleCount): self
  76.     {
  77.         $this->articleCount $articleCount;
  78.         return $this;
  79.     }
  80.     public function getModified(): ?\DateTimeInterface
  81.     {
  82.         return $this->modified;
  83.     }
  84.     public function setModified(\DateTimeInterface $modified): self
  85.     {
  86.         $this->modified $modified;
  87.         return $this;
  88.     }
  89.     public function getCreated(): ?\DateTimeInterface
  90.     {
  91.         return $this->created;
  92.     }
  93.     public function setCreated(\DateTimeInterface $created): self
  94.     {
  95.         $this->created $created;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection<int, ArticleDetails>
  100.      */
  101.     public function getArticleDetails(): Collection
  102.     {
  103.         return $this->articleDetails;
  104.     }
  105.     public function addArticleDetail(ArticleDetails $articleDetail): self
  106.     {
  107.         if (!$this->articleDetails->contains($articleDetail)) {
  108.             $this->articleDetails[] = $articleDetail;
  109.             $articleDetail->setArticle($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeArticleDetail(ArticleDetails $articleDetail): self
  114.     {
  115.         if ($this->articleDetails->removeElement($articleDetail)) {
  116.             // set the owning side to null (unless already changed)
  117.             if ($articleDetail->getArticle() === $this) {
  118.                 $articleDetail->setArticle(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123.     public function getPage(): ?Pages
  124.     {
  125.         return $this->page;
  126.     }
  127.     public function setPage(?Pages $page): self
  128.     {
  129.         $this->page $page;
  130.         return $this;
  131.     }
  132.     public function getIsMulti(): ?int
  133.     {
  134.         return $this->isMulti;
  135.     }
  136.     public function setIsMulti(int $isMulti): self
  137.     {
  138.         $this->isMulti $isMulti;
  139.         return $this;
  140.     }
  141. }