<?php
namespace App\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Intl\Countries;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* User
*
* @ORM\Entity
*/
class User implements UserInterface
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="password", type="string", length=190, nullable=true)
*/
private $password;
/**
* @var string|null
*
* @ORM\Column(name="email", type="string", length=190, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=100, nullable=true)
* @Groups({"api_login", "other_group"})
*/
private $firstName;
/**
* @ORM\Column(type="string", length=100, nullable=true)
* @Groups({"api_login", "other_group"})
*/
private $lastName;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $role;
/**
* @ORM\Column(type="string", length=100, nullable=true)
* @Groups({"api_login", "other_group"})
*/
private $fullName;
/**
* @ORM\OneToOne(targetEntity=Media::class, cascade={"persist", "remove"})
*/
private $avatar;
/**
* @ORM\Column(type="string", length=50, nullable=true)
* @Groups("api_login")
*/
private $country;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $institution;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $departement;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $speciality;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Publication", mappedBy="user")
*
*/
private $publications;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Allpublications", mappedBy="user")
*/
private $allpublications;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Book", mappedBy="user")
*/
private $books;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $verificationCode;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Chapter", mappedBy="user")
*/
private $chapters;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Conference", mappedBy="user")
* @Groups("api_login")
*/
private $conferences;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Journal", inversedBy="users")
*/
private $favoriteJournals;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Follow", inversedBy="followers",cascade={"persist"})
* @Groups("api_login")
*/
private $follows;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Category", inversedBy="users",cascade={"persist"})
*/
private $categories;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $facebook;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $twitter;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $linkedIn;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $instagram;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $youtube;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Groups("api_login")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $birthday;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $gender;
/**
*@ORM\Column(type="boolean", options={"default":"0"}, nullable=true)
*/
private $isDeleted;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $deletedAt;
/**
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $deactivationReason;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $googleId;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $facebookId;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $linkedinId;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $pictureSocial;
/**
* @ORM\OneToMany(targetEntity=Comment::class, mappedBy="publisher", orphanRemoval=true)
* @Groups("api_login")
*/
private $comments;
/**
* @ORM\OneToMany(targetEntity=Report::class, mappedBy="reporter", orphanRemoval=true)
* @Groups("api_login")
*/
private $reports;
/**
* @ORM\OneToMany(targetEntity=Contribution::class, mappedBy="author", orphanRemoval=true)
*/
private $contributions;
public function __construct()
{
$this->publications = new ArrayCollection();
$this->books = new ArrayCollection();
$this->chapters = new ArrayCollection();
$this->conferences = new ArrayCollection();
$this->follows = new ArrayCollection();
$this->categories = new ArrayCollection();
$this->comments = new ArrayCollection();
$this->reports = new ArrayCollection();
$this->contributions = new ArrayCollection();
}
/**
* @return mixed
* @Groups("api_login")
*/
public function getCountry()
{
return $this->country;
}
/**
* @param string $country
*/
public function setCountry($country): void
{
$this->country = $country;
}
/**
* @return string
*/
public function getDepartement()
{
return $this->departement;
}
/**
* @param string $departement
*/
public function setDepartement($departement): void
{
$this->departement = $departement;
}
/**
* @return string
*/
public function getFullName()
{
return $this->fullName;
}
/**
* @param string $fullName
*/
public function setFullName($fullName): void
{
$this->fullName = $fullName;
}
/**
* @return string
*/
public function getInstitution()
{
return $this->institution;
}
/**
* @param string $institution
*/
public function setInstitution($institution): void
{
$this->institution = $institution;
}
/**
* @return string
*/
public function getSpeciality()
{
return $this->speciality;
}
/**
* @param string $speciality
*/
public function setSpeciality($speciality): void
{
$this->speciality = $speciality;
}
/**
* @return Collection|Publication[]
* @Groups("api_login")
*/
public function getPublications(): Collection
{
return $this->publications;
}
public function addPublication(Publication $publication): self
{
if (!$this->publications->contains($publication)) {
$this->publications[] = $publication;
$publication->setRelation($this);
}
return $this;
}
public function removePublication(Publication $publication): self
{
if ($this->publications->contains($publication)) {
$this->publications->removeElement($publication);
// set the owning side to null (unless already changed)
if ($publication->getRelation() === $this) {
$publication->setRelation(null);
}
}
return $this;
}
/**
* @return Collection|Book[]
*/
public function getBooks(): Collection
{
return $this->books;
}
public function addBook(Book $book): self
{
if (!$this->books->contains($book)) {
$this->books[] = $book;
$book->setUser($this);
}
return $this;
}
public function removeBook(Book $book): self
{
if ($this->books->contains($book)) {
$this->books->removeElement($book);
// set the owning side to null (unless already changed)
if ($book->getUser() === $this) {
$book->setUser(null);
}
}
return $this;
}
/**
* @return Collection|Chapter[]
* @Groups("api_login")
*/
public function getChapters(): Collection
{
return $this->chapters;
}
public function addChapter(Chapter $chapter): self
{
if (!$this->chapters->contains($chapter)) {
$this->chapters[] = $chapter;
$chapter->setUser($this);
}
return $this;
}
public function removeChapter(Chapter $chapter): self
{
if ($this->chapters->contains($chapter)) {
$this->chapters->removeElement($chapter);
// set the owning side to null (unless already changed)
if ($chapter->getUser() === $this) {
$chapter->setUser(null);
}
}
return $this;
}
/**
* @return Collection|Conference[]
*/
public function getConferences(): Collection
{
return $this->conferences;
}
public function addConference(Conference $conference): self
{
if (!$this->conferences->contains($conference)) {
$this->conferences[] = $conference;
$conference->setUser($this);
}
return $this;
}
public function removeConference(Conference $conference): self
{
if ($this->conferences->contains($conference)) {
$this->conferences->removeElement($conference);
// set the owning side to null (unless already changed)
if ($conference->getUser() === $this) {
$conference->setUser(null);
}
}
return $this;
}
public function getId(): ?int
{
return $this->id;
}
/**
* @ORM\Column(type="json", nullable=true)
*/
private $roles = [];
/**
* @ORM\Column(type="boolean", options={"default":"0"})
*/
private $is_verified = false;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $token;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $academic_mail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $research_field;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $thesis_subject;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $thesis_director;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $team;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $research_lab;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $doctoral_school;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $university;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $location;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $laboratory_email;
public function setAddresse($adresse): void
{
$this->getContact()->addContactAddress($adresse) ;
}
/**
* @return Collection|Journal[]
* @
*/
public function getFavoriteJournals(): Collection
{
return $this->favoriteJournals;
}
public function addFavoriteJournal(Journal $favoriteJournal): self
{
if (!$this->favoriteJournals->contains($favoriteJournal)) {
$this->favoriteJournals[] = $favoriteJournal;
}
return $this;
}
public function removeFavoriteJournal(Journal $favoriteJournal): self
{
if ($this->favoriteJournals->contains($favoriteJournal)) {
$this->favoriteJournals->removeElement($favoriteJournal);
}
return $this;
}
/**
* @return string
*/
public function getApiBasePath(): string
{
return $this->apiBasePath;
}
/**
* @param string $apiBasePath
*/
public function setApiBasePath(string $apiBasePath): void
{
$this->apiBasePath = $apiBasePath;
}
/**
* @return mixed
*/
public function getFacebook()
{
return $this->facebook;
}
/**
* @param mixed $facebook
*/
public function setFacebook($facebook): void
{
$this->facebook = $facebook;
}
/**
* @return mixed
*/
public function getLinkedIn()
{
return $this->linkedIn;
}
/**
* @param mixed $linkedIn
*/
public function setLinkedIn($linkedIn): void
{
$this->linkedIn = $linkedIn;
}
/**
* @return mixed
*/
public function getTwitter()
{
return $this->twitter;
}
/**
* @param mixed $twitter
*/
public function setTwitter($twitter): void
{
$this->twitter = $twitter;
}
/**
* @return mixed
*/
public function getInstagram()
{
return $this->instagram;
}
/**
* @param mixed $instagram
*/
public function setInstagram($instagram): void
{
$this->instagram = $instagram;
}
/**
* @return mixed
*/
public function getYoutube()
{
return $this->youtube;
}
/**
* @param mixed $youtube
*/
public function setYoutube($youtube): void
{
$this->youtube = $youtube;
}
/**
* @return mixed
*/
public function getAllpublications()
{
return $this->allpublications;
}
/**
* @param mixed $allpublications
*/
public function setAllpublications($allpublications): void
{
$this->allpublications = $allpublications;
}
/**
* @return mixed
*/
public function getFollows()
{
return $this->follows;
}
public function addFollow(Follow $follow): self
{
if (!$this->follows->contains($follow)) {
$this->follows[] = $follow;
}
return $this;
}
public function removeFollow(Follow $follow): self
{
if ($this->follows->contains($follow)) {
$this->follows->removeElement($follow);
}
return $this;
}
/**
* @return mixed
*/
public function getCategories()
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
}
return $this;
}
public function removeCategory(Category $category): self
{
if ($this->categories->contains($category)) {
$this->categories->removeElement($category);
}
return $this;
}
/**
* @return DateTime
*/
public function getBirthday()
{
return $this->birthday;
}
/**
* @param DateTime $birthday
*/
public function setBirthday(?DateTime $birthday): void
{
$this->birthday = $birthday;
}
/**
* @return String
*/
public function getGender()
{
return $this->gender;
}
/**
* @param string $gender
*/
public function setGender(?String $gender): void
{
$this->gender = $gender;
}
/**
* @return DateTime
*
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @param mixed $createdAt
*/
public function setCreatedAt($createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* @return bool
*/
public function getDeleted()
{
return $this->isDeleted;
}
/**
* @param bool $deleted
*/
public function setDeleted(bool $deleted): void
{
$this->isDeleted = $deleted;
}
/**
* @return DateTime
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
/**
* @param DateTime $deletedAt
*/
public function setDeletedAt(DateTime $deletedAt): void
{
$this->deletedAt = $deletedAt;
}
/**
* @return String
*/
public function getDeactivationReason()
{
return $this->deactivationReason;
}
/**
* @param string $reason
*/
public function setDeactivationReason(String $reason): void
{
$this->deactivationReason = $reason;
}
/**
* @return mixed
*/
public function getGoogleId()
{
return $this->googleId;
}
/**
* @param mixed $googleId
*/
public function setGoogleId($googleId): void
{
$this->googleId = $googleId;
}
/**
* @return mixed
*/
public function getPictureSocial()
{
return $this->pictureSocial;
}
/**
* @param mixed $pictureSocial
*/
public function setPictureSocial($pictureSocial): void
{
$this->pictureSocial = $pictureSocial;
}
/**
* @return mixed
*/
public function getFacebookId()
{
return $this->facebookId;
}
/**
* @param mixed $facebookId
*/
public function setFacebookId($facebookId): void
{
$this->facebookId = $facebookId;
}
/**
* @return mixed
*/
public function getLinkedinId()
{
return $this->linkedinId;
}
/**
* @param mixed $linkedinId
*/
public function setLinkedinId($linkedinId): void
{
$this->linkedinId = $linkedinId;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setPublisher($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getPublisher() === $this) {
$comment->setPublisher(null);
}
}
return $this;
}
/**
* @return Collection<int, Report>
*/
public function getReports(): Collection
{
return $this->reports;
}
public function addReport(Report $report): self
{
if (!$this->reports->contains($report)) {
$this->reports[] = $report;
$report->setReporter($this);
}
return $this;
}
public function removeReport(Report $report): self
{
if ($this->reports->removeElement($report)) {
// set the owning side to null (unless already changed)
if ($report->getReporter() === $this) {
$report->setReporter(null);
}
}
return $this;
}
/**
* @return Collection<int, Contribution>
*/
public function getContributions(): Collection
{
return $this->contributions;
}
public function addContribution(Contribution $contribution): self
{
if (!$this->contributions->contains($contribution)) {
$this->contributions[] = $contribution;
$contribution->setAuthor($this);
}
return $this;
}
public function removeContribution(Contribution $contribution): self
{
if ($this->contributions->removeElement($contribution)) {
// set the owning side to null (unless already changed)
if ($contribution->getAuthor() === $this) {
$contribution->setAuthor(null);
}
}
return $this;
}
public function getVerificationCode(): ?int
{
return $this->verificationCode;
}
public function setVerificationCode(?int $verificationCode): self
{
$this->verificationCode = $verificationCode;
return $this;
}
public function getSalt()
{
// TODO: Implement getSalt() method.
}
public function eraseCredentials()
{
// TODO: Implement eraseCredentials() method.
}
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(?string $password): void
{
$this->password = $password;
}
public function getUsername(): ?string
{
return $this->email;
}
public function setUsername(?string $email): void
{
$this->email = $email;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): void
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
/**
* @param mixed $isDeleted
*/
public function setIsDeleted($isDeleted): void
{
$this->isDeleted = $isDeleted;
}
public function getRoles(): ?array
{
$roles= $this->roles;
return $roles ? array_unique($roles) : ['ROLE_USER'];
}
public function addRole(string $role): self
{
$this->roles[] = $role;
return $this;
}
public function removeRole(string $role): self
{
if (false !== $key = array_search($role, $this->roles, true)) {
unset($this->roles[$key]);
$this->roles = array_values($this->roles);
}
return $this;
}
/**
* @return mixed
*/
/**
* @return mixed
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param mixed $lastName
*/
public function setLastName($lastName): void
{
$this->lastName = $lastName;
}
/**
* @return mixed
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param mixed $firstName
*/
public function setFirstName($firstName): void
{
$this->firstName = $firstName;
}
public function getIsVerified(): ?bool
{
return $this->is_verified;
}
public function setIsVerified(bool $is_verified): self
{
$this->is_verified = $is_verified;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
/**
* @return mixed
*/
public function getRole()
{
return $this->role;
}
/**
* @param mixed $role
*/
public function setRole($role): void
{
$this->role = $role;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getAvatar(): ?Media
{
return $this->avatar;
}
public function setAvatar(?Media $avatar): self
{
$this->avatar = $avatar;
return $this;
}
public function getAcademicMail(): ?string
{
return $this->academic_mail;
}
public function setAcademicMail(?string $academic_mail): self
{
$this->academic_mail = $academic_mail;
return $this;
}
public function getResearchField(): ?string
{
return $this->research_field;
}
public function setResearchField(?string $research_field): self
{
$this->research_field = $research_field;
return $this;
}
public function getThesisSubject(): ?string
{
return $this->thesis_subject;
}
public function setThesisSubject(?string $thesis_subject): self
{
$this->thesis_subject = $thesis_subject;
return $this;
}
public function getThesisDirector(): ?string
{
return $this->thesis_director;
}
public function setThesisDirector(?string $thesis_director): self
{
$this->thesis_director = $thesis_director;
return $this;
}
public function getTeam(): ?string
{
return $this->team;
}
public function setTeam(?string $team): self
{
$this->team = $team;
return $this;
}
public function getResearchLab(): ?string
{
return $this->research_lab;
}
public function setResearchLab(?string $research_lab): self
{
$this->research_lab = $research_lab;
return $this;
}
public function getDoctoralSchool(): ?string
{
return $this->doctoral_school;
}
public function setDoctoralSchool(?string $doctoral_school): self
{
$this->doctoral_school = $doctoral_school;
return $this;
}
public function getUniversity(): ?string
{
return $this->university;
}
public function setUniversity(?string $university): self
{
$this->university = $university;
return $this;
}
public function getLocation(): ?string
{
return $this->location;
}
public function setLocation(?string $location): self
{
$this->location = $location;
return $this;
}
public function getLaboratoryEmail(): ?string
{
return $this->laboratory_email;
}
public function setLaboratoryEmail(?string $laboratory_email): self
{
$this->laboratory_email = $laboratory_email;
return $this;
}
}