<?php
namespace App\Entity;
use App\Repository\AdminRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AdminRepository::class)]
class Admin extends User
{
#[ORM\Column(type: 'boolean')]
private $hasAlreadyLoggedIn;
#[ORM\OneToMany(targetEntity: Article::class, mappedBy: 'author')]
private $articles;
#[ORM\OneToMany(targetEntity: Article::class, mappedBy: 'reviewer')]
private $reviewedArticles;
#[ORM\Column(type: 'boolean', nullable: true)]
private $needReview = false;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isEditor;
public function __construct()
{
parent::__construct();
$this->reviewedArticles = new ArrayCollection();
}
public function getHasAlreadyLoggedIn(): ?bool
{
return $this->hasAlreadyLoggedIn;
}
public function setHasAlreadyLoggedIn(bool $hasAlreadyLoggedIn): self
{
$this->hasAlreadyLoggedIn = $hasAlreadyLoggedIn;
return $this;
}
/**
* @return Collection|Article[]
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticle($article): self
{
if (!$this->articles->contains($article)) {
$this->articles[] = $article;
$article->setAuthor($this);
}
return $this;
}
public function removeArticle($article): self
{
if ($this->articles->removeElement($article)) {
// set the owning side to null (unless already changed)
if ($article->getAuthor() === $this) {
$article->setAuthor(null);
}
}
return $this;
}
/**
* @return Collection|Article[]
*/
public function getReviewedArticles(): Collection
{
return $this->reviewedArticles;
}
public function addReviewedArticle(Article $reviewedArticle): self
{
if (!$this->reviewedArticles->contains($reviewedArticle)) {
$this->reviewedArticles[] = $reviewedArticle;
$reviewedArticle->setReviewer($this);
}
return $this;
}
public function removeReviewedArticle(Article $reviewedArticle): self
{
if ($this->reviewedArticles->removeElement($reviewedArticle)) {
// set the owning side to null (unless already changed)
if ($reviewedArticle->getReviewer() === $this) {
$reviewedArticle->setReviewer(null);
}
}
return $this;
}
public function getNeedReview(): ?bool
{
return $this->needReview;
}
public function setNeedReview(?bool $needReview): self
{
$this->needReview = $needReview;
return $this;
}
public function getIsEditor(): ?bool
{
return $this->isEditor;
}
public function setIsEditor(?bool $isEditor): self
{
$this->isEditor = $isEditor;
return $this;
}
}