src/Entity/Admin.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AdminRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassAdminRepository::class)]
  8. class Admin extends User
  9. {
  10.     #[ORM\Column(type'boolean')]
  11.     private $hasAlreadyLoggedIn;
  12.     #[ORM\OneToMany(targetEntityArticle::class, mappedBy'author')]
  13.     private $articles;
  14.     #[ORM\OneToMany(targetEntityArticle::class, mappedBy'reviewer')]
  15.     private $reviewedArticles;
  16.     #[ORM\Column(type'boolean'nullabletrue)]
  17.     private $needReview false;
  18.     #[ORM\Column(type'boolean'nullabletrue)]
  19.     private $isEditor;
  20.     public function __construct()
  21.     {
  22.         parent::__construct();
  23.         $this->reviewedArticles = new ArrayCollection();
  24.     }
  25.     public function getHasAlreadyLoggedIn(): ?bool
  26.     {
  27.         return $this->hasAlreadyLoggedIn;
  28.     }
  29.     public function setHasAlreadyLoggedIn(bool $hasAlreadyLoggedIn): self
  30.     {
  31.         $this->hasAlreadyLoggedIn $hasAlreadyLoggedIn;
  32.         return $this;
  33.     }
  34.     /**
  35.      * @return Collection|Article[]
  36.      */
  37.     public function getArticles(): Collection
  38.     {
  39.         return $this->articles;
  40.     }
  41.     public function addArticle($article): self
  42.     {
  43.         if (!$this->articles->contains($article)) {
  44.             $this->articles[] = $article;
  45.             $article->setAuthor($this);
  46.         }
  47.         return $this;
  48.     }
  49.     public function removeArticle($article): self
  50.     {
  51.         if ($this->articles->removeElement($article)) {
  52.             // set the owning side to null (unless already changed)
  53.             if ($article->getAuthor() === $this) {
  54.                 $article->setAuthor(null);
  55.             }
  56.         }
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection|Article[]
  61.      */
  62.     public function getReviewedArticles(): Collection
  63.     {
  64.         return $this->reviewedArticles;
  65.     }
  66.     public function addReviewedArticle(Article $reviewedArticle): self
  67.     {
  68.         if (!$this->reviewedArticles->contains($reviewedArticle)) {
  69.             $this->reviewedArticles[] = $reviewedArticle;
  70.             $reviewedArticle->setReviewer($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeReviewedArticle(Article $reviewedArticle): self
  75.     {
  76.         if ($this->reviewedArticles->removeElement($reviewedArticle)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($reviewedArticle->getReviewer() === $this) {
  79.                 $reviewedArticle->setReviewer(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84.     public function getNeedReview(): ?bool
  85.     {
  86.         return $this->needReview;
  87.     }
  88.     public function setNeedReview(?bool $needReview): self
  89.     {
  90.         $this->needReview $needReview;
  91.         return $this;
  92.     }
  93.     public function getIsEditor(): ?bool
  94.     {
  95.         return $this->isEditor;
  96.     }
  97.     public function setIsEditor(?bool $isEditor): self
  98.     {
  99.         $this->isEditor $isEditor;
  100.         return $this;
  101.     }
  102. }