src/Entity/ControllerUser.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Eg\Osm\ParkingCarDrawingDetails;
  4. use App\Repository\ControllerUserRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Entity(repositoryClass: ControllerUserRepository::class)]
  11. #[UniqueEntity('controllerId')]
  12. class ControllerUser
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  16.     #[ORM\Column(type: 'integer')]
  17.     private $id;
  18.     #[Assert\GreaterThan(0)]
  19.     #[Assert\NotNull]
  20.     #[ORM\Column(type: 'integer', unique: true)]
  21.     private $controllerId;
  22.     #[ORM\OneToMany(targetEntity: UserPair::class, mappedBy: 'firstUser', orphanRemoval: true)]
  23.     private $userPairs;
  24.     #[ORM\OneToMany(targetEntity: UserSession::class, mappedBy: 'user')]
  25.     private $userSessions;
  26.     #[Assert\GreaterThan(0)]
  27.     #[ORM\Column(type: 'integer', nullable: true)]
  28.     private $controllerEgId;
  29.     #[ORM\Column(type: 'string', length: 70, options: ['default' => '$2b$10$rfdfCXR4hDlQcIJz0ar3aOjGDy5XE3j3hvlgcpsThaeQl6iqxyswu'])]
  30.     private $password = '$2b$10$rfdfCXR4hDlQcIJz0ar3aOjGDy5XE3j3hvlgcpsThaeQl6iqxyswu';
  31.     #[ORM\OneToMany(targetEntity: ParkingCarDrawingDetails::class, mappedBy: 'createdBy')]
  32.     private $parkingCarDrawingDetails;
  33.     #[ORM\Column(type: 'boolean', options: ['default' => true])]
  34.     private $active = true;
  35.     public function __construct()
  36.     {
  37.         $this->userPairs = new ArrayCollection();
  38.         $this->userSessions = new ArrayCollection();
  39.         $this->parkingCarDrawingDetails = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getControllerId(): ?int
  46.     {
  47.         return $this->controllerId;
  48.     }
  49.     public function setControllerId(int $controllerId): self
  50.     {
  51.         $this->controllerId = $controllerId;
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection<int, UserPair>
  56.      */
  57.     public function getUserPairs(): Collection
  58.     {
  59.         return $this->userPairs;
  60.     }
  61.     public function addUserPair(UserPair $userPair): self
  62.     {
  63.         if (!$this->userPairs->contains($userPair)) {
  64.             $this->userPairs[] = $userPair;
  65.             $userPair->setFirstUser($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removeUserPair(UserPair $userPair): self
  70.     {
  71.         if ($this->userPairs->removeElement($userPair)) {
  72.             // set the owning side to null (unless already changed)
  73.             if ($userPair->getFirstUser() === $this) {
  74.                 $userPair->setFirstUser(null);
  75.             }
  76.         }
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, UserSession>
  81.      */
  82.     public function getUserSessions(): Collection
  83.     {
  84.         return $this->userSessions;
  85.     }
  86.     public function addUserSession(UserSession $userSession): self
  87.     {
  88.         if (!$this->userSessions->contains($userSession)) {
  89.             $this->userSessions[] = $userSession;
  90.             $userSession->setUser($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeUserSession(UserSession $userSession): self
  95.     {
  96.         if ($this->userSessions->removeElement($userSession)) {
  97.             // set the owning side to null (unless already changed)
  98.             if ($userSession->getUser() === $this) {
  99.                 $userSession->setUser(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     public function getControllerEgId(): ?int
  105.     {
  106.         return $this->controllerEgId;
  107.     }
  108.     public function setControllerEgId(?int $controllerEgId): self
  109.     {
  110.         $this->controllerEgId = $controllerEgId;
  111.         return $this;
  112.     }
  113.     public function getPassword(): ?string
  114.     {
  115.         return $this->password;
  116.     }
  117.     public function setPassword(string $password): self
  118.     {
  119.         $this->password = $password;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection<int, ParkingCarDrawingDetails>
  124.      */
  125.     public function getParkingCarDrawingDetails(): Collection
  126.     {
  127.         return $this->parkingCarDrawingDetails;
  128.     }
  129.     public function addParkingCarDrawingDetails(ParkingCarDrawingDetails $parkingCarDrawingDetails): self
  130.     {
  131.         if (!$this->parkingCarDrawingDetails->contains($parkingCarDrawingDetails)) {
  132.             $this->parkingCarDrawingDetails[] = $parkingCarDrawingDetails;
  133.             $parkingCarDrawingDetails->setCreatedBy($this);
  134.         }
  135.         return $this;
  136.     }
  137.     public function removeParkingCarDrawingDetails(ParkingCarDrawingDetails $parkingCarDrawingDetails): self
  138.     {
  139.         if ($this->parkingCarDrawingDetails->removeElement($parkingCarDrawingDetails)) {
  140.             // set the owning side to null (unless already changed)
  141.             if ($parkingCarDrawingDetails->getCreatedBy() === $this) {
  142.                 $parkingCarDrawingDetails->setCreatedBy(null);
  143.             }
  144.         }
  145.         return $this;
  146.     }
  147.     public function isActive(): ?bool
  148.     {
  149.         return $this->active;
  150.     }
  151.     public function setActive(bool $active): self
  152.     {
  153.         $this->active = $active;
  154.         return $this;
  155.     }
  156. }