src/Entity/Personal.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PersonalRepository;
  4. use App\Trait\Person;
  5. use App\Trait\PersonPhysical;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[ORM\Entity(repositoryClassPersonalRepository::class)]
  12. class Personal
  13. {
  14.     use TimestampableEntity;
  15.     use Person;
  16.     use PersonPhysical;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[ORM\Column(type'string'length64nullabletrue)]
  22.     private ?string $job;
  23.     #[Assert\Positive]
  24.     #[ORM\Column(type'decimal'precision8scale3nullabletrue)]
  25.     private ?string $salary;
  26.     #[ORM\ManyToOne(targetEntityAgency::class)]
  27.     private ?Agency $affectedAgency;
  28.     #[ORM\ManyToMany(targetEntityAgency::class, inversedBy'authPersonals')]
  29.     private $authAgencies;
  30.     #[ORM\OneToOne(mappedBy'personal'targetEntityUser::class, cascade: ['persist''remove'])]
  31.     private ?User $user;
  32.     #[ORM\ManyToOne(targetEntityProfile::class)]
  33.     private ?Profile $profile;
  34.     public function __construct()
  35.     {
  36.         $this->authAgencies = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getJob(): ?string
  43.     {
  44.         return $this->job;
  45.     }
  46.     public function setJob(?string $job): self
  47.     {
  48.         $this->job $job;
  49.         return $this;
  50.     }
  51.     public function getSalary(): ?string
  52.     {
  53.         return $this->salary;
  54.     }
  55.     public function setSalary(?string $salary): self
  56.     {
  57.         $this->salary $salary;
  58.         return $this;
  59.     }
  60.     public function getAffectedAgency(): ?Agency
  61.     {
  62.         return $this->affectedAgency;
  63.     }
  64.     public function setAffectedAgency(?Agency $affectedAgency): self
  65.     {
  66.         $this->affectedAgency $affectedAgency;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection<int, Agency>
  71.      */
  72.     public function getAuthAgencies(): Collection
  73.     {
  74.         return $this->authAgencies;
  75.     }
  76.     public function addAuthAgency(Agency $authAgency): self
  77.     {
  78.         if (!$this->authAgencies->contains($authAgency)) {
  79.             $this->authAgencies[] = $authAgency;
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeAuthAgency(Agency $authAgency): self
  84.     {
  85.         $this->authAgencies->removeElement($authAgency);
  86.         return $this;
  87.     }
  88.     public function setUser(?User $user): self
  89.     {
  90.         $this->user $user;
  91.         return $this;
  92.     }
  93.     public function getUser(): ?User
  94.     {
  95.         return $this->user;
  96.     }
  97.     public function getProfile(): ?Profile
  98.     {
  99.         return $this->profile;
  100.     }
  101.     public function setProfile(?Profile $profile): self
  102.     {
  103.         $this->profile $profile;
  104.         return $this;
  105.     }
  106. }