src/Entity/Users.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UsersRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=UsersRepository::class)
  9.  */
  10. class Users
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $fname;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $lname;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $email;
  30.     /**
  31.      * @ORM\Column(type="text")
  32.      */
  33.     private $password;
  34.     /**
  35.      * @ORM\Column(type="smallint")
  36.      */
  37.     private $status;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=ShortUrls::class, mappedBy="user", orphanRemoval=true)
  40.      */
  41.     private $shortUrls;
  42.     public function __construct()
  43.     {
  44.         $this->shortUrls = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getFname(): ?string
  51.     {
  52.         return $this->fname;
  53.     }
  54.     public function setFname(string $fname): self
  55.     {
  56.         $this->fname $fname;
  57.         return $this;
  58.     }
  59.     public function getLname(): ?string
  60.     {
  61.         return $this->lname;
  62.     }
  63.     public function setLname(string $lname): self
  64.     {
  65.         $this->lname $lname;
  66.         return $this;
  67.     }
  68.     public function getEmail(): ?string
  69.     {
  70.         return $this->email;
  71.     }
  72.     public function setEmail(string $email): self
  73.     {
  74.         $this->email $email;
  75.         return $this;
  76.     }
  77.     public function getPassword(): ?string
  78.     {
  79.         return $this->password;
  80.     }
  81.     public function setPassword(string $password): self
  82.     {
  83.         $this->password $password;
  84.         return $this;
  85.     }
  86.     public function getStatus(): ?int
  87.     {
  88.         return $this->status;
  89.     }
  90.     public function setStatus(int $status): self
  91.     {
  92.         $this->status $status;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, ShortUrls>
  97.      */
  98.     public function getShortUrls(): Collection
  99.     {
  100.         return $this->shortUrls;
  101.     }
  102.     public function addShortUrl(ShortUrls $shortUrl): self
  103.     {
  104.         if (!$this->shortUrls->contains($shortUrl)) {
  105.             $this->shortUrls[] = $shortUrl;
  106.             $shortUrl->setUser($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeShortUrl(ShortUrls $shortUrl): self
  111.     {
  112.         if ($this->shortUrls->removeElement($shortUrl)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($shortUrl->getUser() === $this) {
  115.                 $shortUrl->setUser(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120. }