src/Entity/LawOffice.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LawOfficeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. #[ORM\Entity(repositoryClass: LawOfficeRepository::class)]
  11. #[Vich\Uploadable]
  12. class LawOffice
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id = null;
  18.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  19.     private ?\DateTimeInterface $CreatedAt = null;
  20.     #[ORM\ManyToOne]
  21.     private ?LawBarOffice $lawBarOffice = null;
  22.     #[ORM\Column(length: 255)]
  23.     private ?string $lawOfficeName = null;
  24.     #[ORM\Column(nullable: true)]
  25.     private ?int $status = null;
  26.     #[ORM\Column(length: 16, nullable: true)]
  27.     private ?string $officePhoneNumber = null;
  28.     #[ORM\Column(length: 255, nullable: true)]
  29.     private ?string $addressLine = null;
  30.     #[ORM\Column(length: 10, nullable: true)]
  31.     private ?string $prefix = null;
  32.     #[ORM\OneToMany(mappedBy: 'LawOffice', targetEntity: User::class)]
  33.     private Collection $users;
  34.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  35.     #[Vich\UploadableField(mapping: 'lawoffice_avatar', fileNameProperty: 'avatarName', size: 'avatarSize')]
  36.     private ?File $avatarFile = null;
  37.     #[ORM\Column(nullable: true)]
  38.     private ?string $avatarName = null;
  39.     #[ORM\Column(nullable: true)]
  40.     private ?int $avatarSize = null;
  41.     #[ORM\OneToMany(mappedBy: 'LawOffice', targetEntity: Client::class)]
  42.     private Collection $clients;
  43.     #[ORM\Column(nullable: true)]
  44.     private ?int $CaseSeq = null;
  45.     public function __construct()
  46.     {
  47.         $this->users = new ArrayCollection();
  48.         $this->clients = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getCreatedAt(): ?\DateTimeInterface
  55.     {
  56.         return $this->CreatedAt;
  57.     }
  58.     public function setCreatedAt(?\DateTimeInterface $CreatedAt): self
  59.     {
  60.         $this->CreatedAt = $CreatedAt;
  61.         return $this;
  62.     }
  63.     public function getLawBarOffice(): ?LawBarOffice
  64.     {
  65.         return $this->lawBarOffice;
  66.     }
  67.     public function setLawBarOffice(?LawBarOffice $lawBarOffice): self
  68.     {
  69.         $this->lawBarOffice = $lawBarOffice;
  70.         return $this;
  71.     }
  72.     public function getLawOfficeName(): ?string
  73.     {
  74.         return $this->lawOfficeName;
  75.     }
  76.     public function setLawOfficeName(string $lawOfficeName): self
  77.     {
  78.         $this->lawOfficeName = $lawOfficeName;
  79.         return $this;
  80.     }
  81.     public function getStatus(): ?int
  82.     {
  83.         return $this->status;
  84.     }
  85.     public function setStatus(int $status): self
  86.     {
  87.         $this->status = $status;
  88.         return $this;
  89.     }
  90.     public function getOfficePhoneNumber(): ?string
  91.     {
  92.         return $this->officePhoneNumber;
  93.     }
  94.     public function setOfficePhoneNumber(?string $officePhoneNumber): self
  95.     {
  96.         $this->officePhoneNumber = $officePhoneNumber;
  97.         return $this;
  98.     }
  99.     public function getAddressLine(): ?string
  100.     {
  101.         return $this->addressLine;
  102.     }
  103.     public function setAddressLine(?string $addressLine): self
  104.     {
  105.         $this->addressLine = $addressLine;
  106.         return $this;
  107.     }
  108.     public function getPrefix(): ?string
  109.     {
  110.         return $this->prefix;
  111.     }
  112.     public function setPrefix(?string $prefix): self
  113.     {
  114.         $this->prefix = $prefix;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection<int, User>
  119.      */
  120.     public function getUsers(): Collection
  121.     {
  122.         return $this->users;
  123.     }
  124.     public function addUser(User $user): self
  125.     {
  126.         if (!$this->users->contains($user)) {
  127.             $this->users->add($user);
  128.             $user->setLawOffice($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeUser(User $user): self
  133.     {
  134.         if ($this->users->removeElement($user)) {
  135.             // set the owning side to null (unless already changed)
  136.             if ($user->getLawOffice() === $this) {
  137.                 $user->setLawOffice(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142.     /**
  143.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  144.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  145.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  146.      * must be able to accept an instance of 'File' as the bundle will inject one here
  147.      * during Doctrine hydration.
  148.      *
  149.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $avatarFile
  150.      */
  151.     public function setAvatarFile(?File $avatarFile = null): void
  152.     {
  153.         $this->avatarFile = $avatarFile;
  154.         if (null !== $avatarFile) {
  155.             // It is required that at least one field changes if you are using doctrine
  156.             // otherwise the event listeners won't be called and the file is lost
  157.             $this->updatedAt = new \DateTimeImmutable();
  158.         }
  159.     }
  160.     public function getAvatarFile(): ?File
  161.     {
  162.         return $this->avatarFile;
  163.     }
  164.     public function setAvatarName(?string $avatarName): void
  165.     {
  166.         $this->avatarName = $avatarName;
  167.     }
  168.     public function getAvatarName(): ?string
  169.     {
  170.         return $this->avatarName;
  171.     }
  172.     public function setAvatarSize(?int $avatarSize): void
  173.     {
  174.         $this->avatarSize = $avatarSize;
  175.     }
  176.     public function getAvatarSize(): ?int
  177.     {
  178.         return $this->avatarSize;
  179.     }
  180.     /**
  181.      * @return Collection<int, Client>
  182.      */
  183.     public function getClients(): Collection
  184.     {
  185.         return $this->clients;
  186.     }
  187.     public function addClient(Client $client): self
  188.     {
  189.         if (!$this->clients->contains($client)) {
  190.             $this->clients->add($client);
  191.             $client->setLawOffice($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeClient(Client $client): self
  196.     {
  197.         if ($this->clients->removeElement($client)) {
  198.             // set the owning side to null (unless already changed)
  199.             if ($client->getLawOffice() === $this) {
  200.                 $client->setLawOffice(null);
  201.             }
  202.         }
  203.         return $this;
  204.     }
  205.     public function getCaseSeq(): ?int
  206.     {
  207.         return $this->CaseSeq;
  208.     }
  209.     public function setCaseSeq(?int $CaseSeq): self
  210.     {
  211.         $this->CaseSeq = $CaseSeq;
  212.         return $this;
  213.     }
  214. }