src/Entity/Users.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\UsersRepository")
  8.  */
  9. class Users
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $firstName;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $lastName;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $nickName;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $email;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $phone;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      */
  40.     private $password;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true, options={"default" : "admin"})
  43.      */
  44.     private $type;
  45.     /**
  46.      * @ORM\Column(type="datetime")
  47.      */
  48.     private $createdDate;
  49.     /**
  50.      * @ORM\Column(type="smallint", nullable=true, options={"default" : 0})
  51.      */
  52.     private $active;
  53.     /**
  54.      * @ORM\Column(type="text", nullable=true)
  55.      */
  56.     private $accessModules;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=Preorders::class, mappedBy="worker")
  59.      */
  60.     private $preorders;
  61.     /**
  62.      * @ORM\ManyToMany(targetEntity=UserAccess::class, mappedBy="userId")
  63.      */
  64.     private $accessModule;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=SeoTask::class, mappedBy="userId")
  67.      */
  68.     private $seoTasks;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=SeoProjectCheck::class, mappedBy="userId")
  71.      */
  72.     private $seoProjectChecks;
  73.     /**
  74.      * @ORM\Column(type="string", length=255, nullable=true)
  75.      */
  76.     private $profileImg;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=Reminder::class, mappedBy="user", orphanRemoval=true)
  79.      */
  80.     private $reminders;
  81.     /**
  82.      * @ORM\ManyToMany(targetEntity=UserResponsibility::class, inversedBy="user")
  83.      */
  84.     private $userResponsibilities;
  85.     public function __construct()
  86.     {
  87.         $this->preorders = new ArrayCollection();
  88.         $this->accessModule = new ArrayCollection();
  89.         $this->seoTasks = new ArrayCollection();
  90.         $this->seoProjectChecks = new ArrayCollection();
  91.         $this->reminders = new ArrayCollection();
  92.         $this->userResponsibilities = new ArrayCollection();
  93.     }
  94.     public function getId(): ?int
  95.     {
  96.         return $this->id;
  97.     }
  98.     public function getFirstName(): ?string
  99.     {
  100.         return $this->firstName;
  101.     }
  102.     public function setFirstName(string $firstName): self
  103.     {
  104.         $this->firstName $firstName;
  105.         return $this;
  106.     }
  107.     public function getLastName(): ?string
  108.     {
  109.         return $this->lastName;
  110.     }
  111.     public function setLastName(?string $lastName): self
  112.     {
  113.         $this->lastName $lastName;
  114.         return $this;
  115.     }
  116.     public function getNickName(): ?string
  117.     {
  118.         return $this->nickName;
  119.     }
  120.     public function setNickName(?string $nickName): self
  121.     {
  122.         $this->nickName $nickName;
  123.         return $this;
  124.     }
  125.     public function getEmail(): ?string
  126.     {
  127.         return $this->email;
  128.     }
  129.     public function setEmail(string $email): self
  130.     {
  131.         $this->email $email;
  132.         return $this;
  133.     }
  134.     public function getPhone(): ?string
  135.     {
  136.         return $this->phone;
  137.     }
  138.     public function setPhone(string $phone): self
  139.     {
  140.         $this->phone $phone;
  141.         return $this;
  142.     }
  143.     public function getPassword(): ?string
  144.     {
  145.         return $this->password;
  146.     }
  147.     public function setPassword(string $password): self
  148.     {
  149.         $this->password $password;
  150.         return $this;
  151.     }
  152.     public function getType(): ?string
  153.     {
  154.         return $this->type;
  155.     }
  156.     public function setType(string $type): self
  157.     {
  158.         $this->type $type;
  159.         return $this;
  160.     }
  161.     public function getCreatedDate(): ?\DateTimeInterface
  162.     {
  163.         return $this->createdDate;
  164.     }
  165.     public function setCreatedDate(\DateTimeInterface $createdDate): self
  166.     {
  167.         $this->createdDate $createdDate;
  168.         return $this;
  169.     }
  170.     public function getActive(): ?int
  171.     {
  172.         return $this->active;
  173.     }
  174.     public function setActive(int $active): self
  175.     {
  176.         $this->active $active;
  177.         return $this;
  178.     }
  179.     public function getAccessModules(): ?string
  180.     {
  181.         return $this->accessModules;
  182.     }
  183.     public function setAccessModules(?string $accessModules): self
  184.     {
  185.         $this->accessModules $accessModules;
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, Preorders>
  190.      */
  191.     public function getPreorders(): Collection
  192.     {
  193.         return $this->preorders;
  194.     }
  195.     public function addPreorder(Preorders $preorder): self
  196.     {
  197.         if (!$this->preorders->contains($preorder)) {
  198.             $this->preorders[] = $preorder;
  199.             $preorder->setWorker($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removePreorder(Preorders $preorder): self
  204.     {
  205.         if ($this->preorders->removeElement($preorder)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($preorder->getWorker() === $this) {
  208.                 $preorder->setWorker(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return Collection<int, UserAccess>
  215.      */
  216.     public function getAccessModule(): Collection
  217.     {
  218.         return $this->accessModule;
  219.     }
  220.     public function addAccessModule(UserAccess $accessModule): self
  221.     {
  222.         if (!$this->accessModule->contains($accessModule)) {
  223.             $this->accessModule[] = $accessModule;
  224.             $accessModule->addUserId($this);
  225.         }
  226.         return $this;
  227.     }
  228.     public function removeAccessModule(UserAccess $accessModule): self
  229.     {
  230.         if ($this->accessModule->removeElement($accessModule)) {
  231.             $accessModule->removeUserId($this);
  232.         }
  233.         return $this;
  234.     }
  235.     /**
  236.      * @return Collection<int, SeoTask>
  237.      */
  238.     public function getSeoTasks(): Collection
  239.     {
  240.         return $this->seoTasks;
  241.     }
  242.     public function addSeoTask(SeoTask $seoTask): self
  243.     {
  244.         if (!$this->seoTasks->contains($seoTask)) {
  245.             $this->seoTasks[] = $seoTask;
  246.             $seoTask->setUserId($this);
  247.         }
  248.         return $this;
  249.     }
  250.     public function removeSeoTask(SeoTask $seoTask): self
  251.     {
  252.         if ($this->seoTasks->removeElement($seoTask)) {
  253.             // set the owning side to null (unless already changed)
  254.             if ($seoTask->getUserId() === $this) {
  255.                 $seoTask->setUserId(null);
  256.             }
  257.         }
  258.         return $this;
  259.     }
  260.     /**
  261.      * @return Collection<int, SeoProjectCheck>
  262.      */
  263.     public function getSeoProjectChecks(): Collection
  264.     {
  265.         return $this->seoProjectChecks;
  266.     }
  267.     public function addSeoProjectCheck(SeoProjectCheck $seoProjectCheck): self
  268.     {
  269.         if (!$this->seoProjectChecks->contains($seoProjectCheck)) {
  270.             $this->seoProjectChecks[] = $seoProjectCheck;
  271.             $seoProjectCheck->setUserId($this);
  272.         }
  273.         return $this;
  274.     }
  275.     public function removeSeoProjectCheck(SeoProjectCheck $seoProjectCheck): self
  276.     {
  277.         if ($this->seoProjectChecks->removeElement($seoProjectCheck)) {
  278.             // set the owning side to null (unless already changed)
  279.             if ($seoProjectCheck->getUserId() === $this) {
  280.                 $seoProjectCheck->setUserId(null);
  281.             }
  282.         }
  283.         return $this;
  284.     }
  285.     public function getProfileImg(): ?string
  286.     {
  287.         return $this->profileImg;
  288.     }
  289.     public function setProfileImg(?string $profileImg): self
  290.     {
  291.         $this->profileImg $profileImg;
  292.         return $this;
  293.     }
  294.     public function getProfilePicture() :?string
  295.     {
  296.         $img '<img src="' $this->profileImg '" class="profilePic" alt="Zdjęcie profilowe użytkownika ' $this->firstName ' ' $this->lastName '" title="' $this->firstName ' ' $this->lastName .'"/>';
  297.         return $img;
  298.     }
  299.     public function getProfile() :?string
  300.     {
  301.         $profile = ($this->getProfileImg()) ? $this->getProfilePicture() : $this->getFirstName();
  302.         return $profile;
  303.     }
  304.     /**
  305.      * @return Collection<int, Reminder>
  306.      */
  307.     public function getReminders(): Collection
  308.     {
  309.         return $this->reminders;
  310.     }
  311.     public function addReminder(Reminder $reminder): self
  312.     {
  313.         if (!$this->reminders->contains($reminder)) {
  314.             $this->reminders[] = $reminder;
  315.             $reminder->setUser($this);
  316.         }
  317.         return $this;
  318.     }
  319.     public function removeReminder(Reminder $reminder): self
  320.     {
  321.         if ($this->reminders->removeElement($reminder)) {
  322.             // set the owning side to null (unless already changed)
  323.             if ($reminder->getUser() === $this) {
  324.                 $reminder->setUser(null);
  325.             }
  326.         }
  327.         return $this;
  328.     }
  329.     /**
  330.      * @return Collection<int, UserResponsibility>
  331.      */
  332.     public function getUserResponsibilities(): Collection
  333.     {
  334.         return $this->userResponsibilities;
  335.     }
  336.     public function addUserResponsibility(UserResponsibility $userResponsibility): self
  337.     {
  338.         if (!$this->userResponsibilities->contains($userResponsibility)) {
  339.             $this->userResponsibilities[] = $userResponsibility;
  340.             $userResponsibility->addUser($this);
  341.         }
  342.         return $this;
  343.     }
  344.     public function removeUserResponsibility(UserResponsibility $userResponsibility): self
  345.     {
  346.         if ($this->userResponsibilities->removeElement($userResponsibility)) {
  347.             $userResponsibility->removeUser($this);
  348.         }
  349.         return $this;
  350.     }
  351. }