src/Entity/MobileParentAppAccount.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTimeImmutable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use App\Repository\MobileParentAppAccountRepository;
  8. /**
  9.  * @ORM\Entity(repositoryClass=MobileParentAppAccountRepository::class)
  10.  */
  11. class MobileParentAppAccount
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=128)
  21.      */
  22.     private $last_name;
  23.     /**
  24.      * @ORM\Column(type="string", length=128)
  25.      */
  26.     private $first_name;
  27.     /**
  28.      * @ORM\Column(type="string", length=128)
  29.      */
  30.     private $phone_number;
  31.     /**
  32.      * @ORM\Column(type="string", length=180, unique=true)
  33.     */
  34.     private $username;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $password;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.     */
  42.     private $device_token;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="mobileParentAppAccounts")
  45.      * @ORM\JoinColumn(nullable=false)
  46.      */
  47.     private $establishment;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      */
  51.     private $is_enabled;
  52.     /**
  53.      * @ORM\Column(type="boolean")
  54.      */
  55.     private $is_password_changed;
  56.     /**
  57.      * @ORM\Column(type="integer", nullable=true)
  58.      */
  59.     private $last_auth_time;
  60.     /**
  61.      * @ORM\Column(type="string", length=255, nullable=true)
  62.      */
  63.     private $token;
  64.     /**
  65.      * @ORM\Column(type="date_immutable")
  66.     */
  67.     private $create_at;
  68.     /**
  69.      * @ORM\Column(type="datetime_immutable")
  70.     */
  71.     private $created_at;
  72.     /**
  73.      * @ORM\Column(type="datetime_immutable")
  74.      */
  75.     private $updated_at;
  76.     /**
  77.      * @ORM\Column(type="integer")
  78.      */
  79.     private $created_by;
  80.     /**
  81.      * @ORM\Column(type="integer")
  82.      */
  83.     private $updated_by;
  84.     /**
  85.      * @ORM\ManyToMany(targetEntity=RegistrationStudent::class, inversedBy="mobileParentAppAccounts")
  86.      */
  87.     private $registrationStudents;
  88.     /**
  89.      * @ORM\OneToMany(targetEntity=MobileParentAppAccountActivity::class, mappedBy="mobileParentAppAccount")
  90.      */
  91.     private $mobileParentAppAccountActivities;
  92.     /**
  93.      * @ORM\Column(type="string", length=60, nullable=true)
  94.      */
  95.     private $device;
  96.     public function __construct()
  97.     {
  98.         $this->is_enabled true;
  99.         $this->is_password_changed false;
  100.         $this->registrationStudents = new ArrayCollection();
  101.         $this->create_at = new DateTimeImmutable();
  102.         $this->mobileParentAppAccountActivities = new ArrayCollection();
  103.     }
  104.     public function getId(): ?int
  105.     {
  106.         return $this->id;
  107.     }
  108.     public function getUsername(): ?string
  109.     {
  110.         return $this->username;
  111.     }
  112.     public function setUsername(string $username): self
  113.     {
  114.         $this->username $username;
  115.         return $this;
  116.     }
  117.     public function getPassword(): ?string
  118.     {
  119.         return $this->password;
  120.     }
  121.     public function setPassword(string $password): self
  122.     {
  123.         $this->password $password;
  124.         return $this;
  125.     }
  126.     public function getEstablishment(): ?Establishment
  127.     {
  128.         return $this->establishment;
  129.     }
  130.     public function setEstablishment(?Establishment $establishment): self
  131.     {
  132.         $this->establishment $establishment;
  133.         return $this;
  134.     }
  135.     public function getIsEnabled(): ?bool
  136.     {
  137.         return $this->is_enabled;
  138.     }
  139.     public function setIsEnabled(bool $is_enabled): self
  140.     {
  141.         $this->is_enabled $is_enabled;
  142.         return $this;
  143.     }
  144.     public function getIsPasswordChanged(): ?bool
  145.     {
  146.         return $this->is_password_changed;
  147.     }
  148.     public function setIsPasswordChanged(bool $is_password_changed): self
  149.     {
  150.         $this->is_password_changed $is_password_changed;
  151.         return $this;
  152.     }
  153.     public function getLastAuthTime(): ?int
  154.     {
  155.         return $this->last_auth_time;
  156.     }
  157.     public function setLastAuthTime(?int $last_auth_time): self
  158.     {
  159.         $this->last_auth_time $last_auth_time;
  160.         return $this;
  161.     }
  162.     public function getToken(): ?string
  163.     {
  164.         return $this->token;
  165.     }
  166.     public function setToken(?string $token): self
  167.     {
  168.         $this->token $token;
  169.         return $this;
  170.     }
  171.     /**
  172.      * @return Collection|RegistrationStudent[]
  173.      */
  174.     public function getRegistrationStudents(): Collection
  175.     {
  176.         return $this->registrationStudents;
  177.     }
  178.     public function addRegistrationStudent(RegistrationStudent $registrationStudent): self
  179.     {
  180.         if (!$this->registrationStudents->contains($registrationStudent)) {
  181.             $this->registrationStudents[] = $registrationStudent;
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeRegistrationStudent(RegistrationStudent $registrationStudent): self
  186.     {
  187.         $this->registrationStudents->removeElement($registrationStudent);
  188.         return $this;
  189.     }
  190.     public function getLastName(): ?string
  191.     {
  192.         return $this->last_name;
  193.     }
  194.     public function setLastName(string $last_name): self
  195.     {
  196.         $this->last_name $last_name;
  197.         return $this;
  198.     }
  199.     public function getFirstName(): ?string
  200.     {
  201.         return $this->first_name;
  202.     }
  203.     public function setFirstName(string $first_name): self
  204.     {
  205.         $this->first_name $first_name;
  206.         return $this;
  207.     }
  208.     public function getPhoneNumber(): ?string
  209.     {
  210.         return $this->phone_number;
  211.     }
  212.     public function setPhoneNumber(string $phone_number): self
  213.     {
  214.         $this->phone_number $phone_number;
  215.         return $this;
  216.     }
  217.     public function getCreateAt(): ?\DateTimeImmutable
  218.     {
  219.         return $this->create_at;
  220.     }
  221.     public function setCreateAt(\DateTimeImmutable $create_at): self
  222.     {
  223.         $this->create_at $create_at;
  224.         return $this;
  225.     }
  226.     public function getCreatedAt(): ?\DateTimeImmutable
  227.     {
  228.         return $this->created_at;
  229.     }
  230.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  231.     {
  232.         $this->created_at $created_at;
  233.         return $this;
  234.     }
  235.     public function getUpdatedAt(): ?\DateTimeImmutable
  236.     {
  237.         return $this->updated_at;
  238.     }
  239.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  240.     {
  241.         $this->updated_at $updated_at;
  242.         return $this;
  243.     }
  244.     public function getCreatedBy(): ?int
  245.     {
  246.         return $this->created_by;
  247.     }
  248.     public function setCreatedBy(int $created_by): self
  249.     {
  250.         $this->created_by $created_by;
  251.         return $this;
  252.     }
  253.     public function getUpdatedBy(): ?int
  254.     {
  255.         return $this->updated_by;
  256.     }
  257.     public function setUpdatedBy(int $updated_by): self
  258.     {
  259.         $this->updated_by $updated_by;
  260.         return $this;
  261.     }
  262.     public function isTokenValid()
  263.     {
  264.         return ($this->getLastAuthTime() + 604800) > time();
  265.     }
  266.     /**
  267.      * @return Collection|MobileParentAppAccountActivity[]
  268.      */
  269.     public function getMobileParentAppAccountActivities(): Collection
  270.     {
  271.         return $this->mobileParentAppAccountActivities;
  272.     }
  273.     public function addMobileParentAppAccountActivity(MobileParentAppAccountActivity $mobileParentAppAccountActivity): self
  274.     {
  275.         if (!$this->mobileParentAppAccountActivities->contains($mobileParentAppAccountActivity)) {
  276.             $this->mobileParentAppAccountActivities[] = $mobileParentAppAccountActivity;
  277.             $mobileParentAppAccountActivity->setMobileParentAppAccount($this);
  278.         }
  279.         return $this;
  280.     }
  281.     public function removeMobileParentAppAccountActivity(MobileParentAppAccountActivity $mobileParentAppAccountActivity): self
  282.     {
  283.         if ($this->mobileParentAppAccountActivities->removeElement($mobileParentAppAccountActivity)) {
  284.             // set the owning side to null (unless already changed)
  285.             if ($mobileParentAppAccountActivity->getMobileParentAppAccount() === $this) {
  286.                 $mobileParentAppAccountActivity->setMobileParentAppAccount(null);
  287.             }
  288.         }
  289.         return $this;
  290.     }
  291.     public function getDevice(): ?string
  292.     {
  293.         return $this->device;
  294.     }
  295.     public function setDevice(?string $device): self
  296.     {
  297.         $this->device $device;
  298.         return $this;
  299.     }
  300.     public function getDeviceToken(): ?string
  301.     {
  302.         return $this->device_token;
  303.     }
  304.     public function setDeviceToken(?string $device_token): self
  305.     {
  306.         $this->device_token $device_token;
  307.         return $this;
  308.     }
  309. }