<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\UsersRepository")
*/
class Users
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $firstName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lastName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nickName;
/**
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $password;
/**
* @ORM\Column(type="string", length=255, nullable=true, options={"default" : "admin"})
*/
private $type;
/**
* @ORM\Column(type="datetime")
*/
private $createdDate;
/**
* @ORM\Column(type="smallint", nullable=true, options={"default" : 0})
*/
private $active;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $accessModules;
/**
* @ORM\OneToMany(targetEntity=Preorders::class, mappedBy="worker")
*/
private $preorders;
/**
* @ORM\ManyToMany(targetEntity=UserAccess::class, mappedBy="userId")
*/
private $accessModule;
/**
* @ORM\OneToMany(targetEntity=SeoTask::class, mappedBy="userId")
*/
private $seoTasks;
/**
* @ORM\OneToMany(targetEntity=SeoProjectCheck::class, mappedBy="userId")
*/
private $seoProjectChecks;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $profileImg;
/**
* @ORM\OneToMany(targetEntity=Reminder::class, mappedBy="user", orphanRemoval=true)
*/
private $reminders;
/**
* @ORM\ManyToMany(targetEntity=UserResponsibility::class, inversedBy="user")
*/
private $userResponsibilities;
public function __construct()
{
$this->preorders = new ArrayCollection();
$this->accessModule = new ArrayCollection();
$this->seoTasks = new ArrayCollection();
$this->seoProjectChecks = new ArrayCollection();
$this->reminders = new ArrayCollection();
$this->userResponsibilities = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getNickName(): ?string
{
return $this->nickName;
}
public function setNickName(?string $nickName): self
{
$this->nickName = $nickName;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getCreatedDate(): ?\DateTimeInterface
{
return $this->createdDate;
}
public function setCreatedDate(\DateTimeInterface $createdDate): self
{
$this->createdDate = $createdDate;
return $this;
}
public function getActive(): ?int
{
return $this->active;
}
public function setActive(int $active): self
{
$this->active = $active;
return $this;
}
public function getAccessModules(): ?string
{
return $this->accessModules;
}
public function setAccessModules(?string $accessModules): self
{
$this->accessModules = $accessModules;
return $this;
}
/**
* @return Collection<int, Preorders>
*/
public function getPreorders(): Collection
{
return $this->preorders;
}
public function addPreorder(Preorders $preorder): self
{
if (!$this->preorders->contains($preorder)) {
$this->preorders[] = $preorder;
$preorder->setWorker($this);
}
return $this;
}
public function removePreorder(Preorders $preorder): self
{
if ($this->preorders->removeElement($preorder)) {
// set the owning side to null (unless already changed)
if ($preorder->getWorker() === $this) {
$preorder->setWorker(null);
}
}
return $this;
}
/**
* @return Collection<int, UserAccess>
*/
public function getAccessModule(): Collection
{
return $this->accessModule;
}
public function addAccessModule(UserAccess $accessModule): self
{
if (!$this->accessModule->contains($accessModule)) {
$this->accessModule[] = $accessModule;
$accessModule->addUserId($this);
}
return $this;
}
public function removeAccessModule(UserAccess $accessModule): self
{
if ($this->accessModule->removeElement($accessModule)) {
$accessModule->removeUserId($this);
}
return $this;
}
/**
* @return Collection<int, SeoTask>
*/
public function getSeoTasks(): Collection
{
return $this->seoTasks;
}
public function addSeoTask(SeoTask $seoTask): self
{
if (!$this->seoTasks->contains($seoTask)) {
$this->seoTasks[] = $seoTask;
$seoTask->setUserId($this);
}
return $this;
}
public function removeSeoTask(SeoTask $seoTask): self
{
if ($this->seoTasks->removeElement($seoTask)) {
// set the owning side to null (unless already changed)
if ($seoTask->getUserId() === $this) {
$seoTask->setUserId(null);
}
}
return $this;
}
/**
* @return Collection<int, SeoProjectCheck>
*/
public function getSeoProjectChecks(): Collection
{
return $this->seoProjectChecks;
}
public function addSeoProjectCheck(SeoProjectCheck $seoProjectCheck): self
{
if (!$this->seoProjectChecks->contains($seoProjectCheck)) {
$this->seoProjectChecks[] = $seoProjectCheck;
$seoProjectCheck->setUserId($this);
}
return $this;
}
public function removeSeoProjectCheck(SeoProjectCheck $seoProjectCheck): self
{
if ($this->seoProjectChecks->removeElement($seoProjectCheck)) {
// set the owning side to null (unless already changed)
if ($seoProjectCheck->getUserId() === $this) {
$seoProjectCheck->setUserId(null);
}
}
return $this;
}
public function getProfileImg(): ?string
{
return $this->profileImg;
}
public function setProfileImg(?string $profileImg): self
{
$this->profileImg = $profileImg;
return $this;
}
public function getProfilePicture() :?string
{
$img = '<img src="' . $this->profileImg . '" class="profilePic" alt="Zdjęcie profilowe użytkownika ' . $this->firstName . ' ' . $this->lastName . '" title="' . $this->firstName . ' ' . $this->lastName .'"/>';
return $img;
}
public function getProfile() :?string
{
$profile = ($this->getProfileImg()) ? $this->getProfilePicture() : $this->getFirstName();
return $profile;
}
/**
* @return Collection<int, Reminder>
*/
public function getReminders(): Collection
{
return $this->reminders;
}
public function addReminder(Reminder $reminder): self
{
if (!$this->reminders->contains($reminder)) {
$this->reminders[] = $reminder;
$reminder->setUser($this);
}
return $this;
}
public function removeReminder(Reminder $reminder): self
{
if ($this->reminders->removeElement($reminder)) {
// set the owning side to null (unless already changed)
if ($reminder->getUser() === $this) {
$reminder->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, UserResponsibility>
*/
public function getUserResponsibilities(): Collection
{
return $this->userResponsibilities;
}
public function addUserResponsibility(UserResponsibility $userResponsibility): self
{
if (!$this->userResponsibilities->contains($userResponsibility)) {
$this->userResponsibilities[] = $userResponsibility;
$userResponsibility->addUser($this);
}
return $this;
}
public function removeUserResponsibility(UserResponsibility $userResponsibility): self
{
if ($this->userResponsibilities->removeElement($userResponsibility)) {
$userResponsibility->removeUser($this);
}
return $this;
}
}