src/Entity/Agency.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AgencyRepository;
  4. use App\Trait\GeographicCoordinates;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Entity(repositoryClassAgencyRepository::class)]
  11. class Agency
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private $id;
  17.     #[ORM\Column(type'string'length255)]
  18.     #[Assert\NotBlank(message'This value should not be blank')]
  19.     private ?string $name;
  20.     #[ORM\Column(type'string'length255nullabletrue)]
  21.     #[Assert\NotBlank]
  22.     private ?string $address;
  23.     #[ORM\Column(typeTypes::STRING,length20nullabletrue)]
  24.     #[Assert\Regex(pattern"/^\+?\d{1,3}?[-. ]?\d{7,10}$/")]
  25.     private ?string $phone null;
  26.     use GeographicCoordinates;
  27.     #[ORM\Column(type'boolean')]
  28.     private bool $active;
  29.     #[ORM\ManyToOne(targetEntityCity::class)]
  30.     private ?City $city;
  31.     #[ORM\ManyToMany(targetEntityPersonal::class, mappedBy'authAgencies')]
  32.     private $authPersonals;
  33.     #[ORM\Column(length3nullabletrue)]
  34.     private ?string $currency null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?bool $isDefault null;
  37.     public function __construct()
  38.     {
  39.         $this->authPersonals = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(?string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     public function getAddress(): ?string
  55.     {
  56.         return $this->address;
  57.     }
  58.     public function setAddress(?string $address): self
  59.     {
  60.         $this->address $address;
  61.         return $this;
  62.     }
  63.     public function getPhone(): ?string
  64.     {
  65.         return $this->phone;
  66.     }
  67.     public function setPhone(?string $phone): self
  68.     {
  69.         $this->phone $phone;
  70.         return $this;
  71.     }
  72.     public function getCity(): ?City
  73.     {
  74.         return $this->city;
  75.     }
  76.     public function setCity(?City $city): self
  77.     {
  78.         $this->city $city;
  79.         return $this;
  80.     }
  81.     public function isActive(): ?bool
  82.     {
  83.         return $this->active;
  84.     }
  85.     public function setActive(bool $active): self
  86.     {
  87.         $this->active $active;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return Collection<int, Personal>
  92.      */
  93.     public function getAuthPersonals(): Collection
  94.     {
  95.         return $this->authPersonals;
  96.     }
  97.     public function addAuthPersonal(Personal $authPersonal): self
  98.     {
  99.         if (!$this->authPersonals->contains($authPersonal)) {
  100.             $this->authPersonals[] = $authPersonal;
  101.             $authPersonal->addAuthAgency($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeAuthPersonal(Personal $authPersonal): self
  106.     {
  107.         if ($this->authPersonals->removeElement($authPersonal)) {
  108.             $authPersonal->removeAuthAgency($this);
  109.         }
  110.         return $this;
  111.     }
  112.     public function __toString(): string
  113.     {
  114.         return $this->name;
  115.     }
  116.     public function getCurrency(): ?string
  117.     {
  118.         return $this->currency;
  119.     }
  120.     public function setCurrency(?string $currency): self
  121.     {
  122.         $this->currency $currency;
  123.         return $this;
  124.     }
  125.     public function isIsDefault(): ?bool
  126.     {
  127.         return $this->isDefault;
  128.     }
  129.     public function setIsDefault(?bool $isDefault): self
  130.     {
  131.         $this->isDefault $isDefault;
  132.         return $this;
  133.     }
  134. }