src/Entity/Sucursal.php line 19

  1. <?php
  2. namespace App\Entity;
  3. use App\Interfaces\OwnerCompanyCompanyInterface;
  4. use App\Repository\SucursalRepository;
  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\HttpFoundation\File\File;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints\Image;
  12. use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
  13. use Vich\UploaderBundle\Mapping\Annotation\UploadableField;
  14. #[ORM\Entity(repositoryClassSucursalRepository::class)]
  15. #[Uploadable]
  16. class Sucursal implements OwnerCompanyCompanyInterface
  17. {
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     #[Groups(["sucursal_out"])]
  22.     private ?int $id null;
  23.     #[ORM\ManyToOne(inversedBy'sucursals')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?SriInfo $company null;
  26.     #[ORM\Column(length255)]
  27.     #[Groups(["sucursal_out"])]
  28.     private ?string $location null;
  29.     #[ORM\Column(length50)]
  30.     #[Groups(["sucursal_out"])]
  31.     private ?string $email null;
  32.     #[ORM\Column(length20nullabletrue)]
  33.     #[Groups(["sucursal_out"])]
  34.     private ?string $phone null;
  35.     #[ORM\Column(length5)]
  36.     #[Groups(["sucursal_out"])]
  37.     private ?string $establishment null;
  38.     #[ORM\Column(length5)]
  39.     #[Groups(["sucursal_out"])]
  40.     private ?string $emitionPoint null;
  41.     #[ORM\OneToMany(mappedBy'sucursal'targetEntitySequence::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  42.     private Collection $sequences;
  43.     #[ORM\Column(length255)]
  44.     #[Groups(["sucursal_out"])]
  45.     private ?string $Name null;
  46.     #[ORM\OneToMany(mappedBy'sucursal'targetEntityInvoice::class)]
  47.     private Collection $invoices;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     private ?string $image null;
  50.     #[UploadableField('sucursal''image')]
  51.     #[Image(maxSize"1M"mimeTypes: ["image/jpeg""image/png"])]
  52.     private ?File $imageFile null;
  53.     #[ORM\Column(nullabletrue)]
  54.     private ?int $external null;
  55.     #[ORM\Column(length10)]
  56.     private ?string $numeroCasa null;
  57.     #[ORM\Column(length255nullabletrue)]
  58.     private ?string $complementoDireccion1 null;
  59.     #[ORM\Column(length255nullabletrue)]
  60.     private ?string $complementoDireccion2 null;
  61.     #[ORM\Column]
  62.     private ?int $departamento null;
  63.     #[ORM\Column(length255)]
  64.     private ?string $departamentoDescripcion null;
  65.     #[ORM\Column]
  66.     private ?int $distrito null;
  67.     #[ORM\Column(length255)]
  68.     private ?string $distritoDescripcion null;
  69.     #[ORM\Column]
  70.     private ?int $ciudad null;
  71.     #[ORM\Column(length255)]
  72.     private ?string $ciudadDescripcion null;
  73.     #[ORM\Column(length255nullabletrue)]
  74.     private ?string $denominacion null;
  75.     #[ORM\OneToMany(mappedBy'sucursal'targetEntitySriPayment::class)]
  76.     private Collection $sriPayments;
  77.     #[ORM\OneToMany(mappedBy'sucursal'targetEntityPaymentCredit::class)]
  78.     private Collection $paymentCredits;
  79.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  80.     private ?\DateTimeInterface $updatedDate null;
  81.     public function __construct()
  82.     {
  83.         $this->sequences = new ArrayCollection();
  84.         $this->invoices = new ArrayCollection();
  85.         $this->sriPayments = new ArrayCollection();
  86.         $this->paymentCredits = new ArrayCollection();
  87.     }
  88.     public function getId(): ?int
  89.     {
  90.         return $this->id;
  91.     }
  92.     public function getCompany(): ?SriInfo
  93.     {
  94.         return $this->company;
  95.     }
  96.     public function setCompany(?SriInfo $company): self
  97.     {
  98.         $this->company $company;
  99.         return $this;
  100.     }
  101.     public function getLocation(): ?string
  102.     {
  103.         return $this->location;
  104.     }
  105.     public function setLocation(string $location): self
  106.     {
  107.         $this->location $location;
  108.         return $this;
  109.     }
  110.     public function getEmail(): ?string
  111.     {
  112.         return $this->email;
  113.     }
  114.     public function setEmail(string $email): self
  115.     {
  116.         $this->email $email;
  117.         return $this;
  118.     }
  119.     public function getPhone(): ?string
  120.     {
  121.         return $this->phone;
  122.     }
  123.     public function setPhone(?string $phone): self
  124.     {
  125.         $this->phone $phone;
  126.         return $this;
  127.     }
  128.     public function getEstablishment(): ?string
  129.     {
  130.         return $this->establishment;
  131.     }
  132.     public function setEstablishment(string $establishment): self
  133.     {
  134.         $this->establishment $establishment;
  135.         return $this;
  136.     }
  137.     public function getEmitionPoint(): ?string
  138.     {
  139.         return $this->emitionPoint;
  140.     }
  141.     public function setEmitionPoint(string $emitionPoint): self
  142.     {
  143.         $this->emitionPoint $emitionPoint;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection<int, Sequence>
  148.      */
  149.     public function getSequences(): Collection
  150.     {
  151.         return $this->sequences;
  152.     }
  153.     public function addSequence(Sequence $sequence): self
  154.     {
  155.         if (!$this->sequences->contains($sequence)) {
  156.             $this->sequences->add($sequence);
  157.             $sequence->setSucursal($this);
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeSequence(Sequence $sequence): self
  162.     {
  163.         if ($this->sequences->removeElement($sequence)) {
  164.             // set the owning side to null (unless already changed)
  165.             if ($sequence->getSucursal() === $this) {
  166.                 $sequence->setSucursal(null);
  167.             }
  168.         }
  169.         return $this;
  170.     }
  171.     public function getName(): ?string
  172.     {
  173.         return $this->Name;
  174.     }
  175.     public function setName(string $Name): self
  176.     {
  177.         $this->Name $Name;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, Invoice>
  182.      */
  183.     public function getInvoices(): Collection
  184.     {
  185.         return $this->invoices;
  186.     }
  187.     public function addInvoice(Invoice $invoice): self
  188.     {
  189.         if (!$this->invoices->contains($invoice)) {
  190.             $this->invoices->add($invoice);
  191.             $invoice->setSucursal($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeInvoice(Invoice $invoice): self
  196.     {
  197.         if ($this->invoices->removeElement($invoice)) {
  198.             // set the owning side to null (unless already changed)
  199.             if ($invoice->getSucursal() === $this) {
  200.                 $invoice->setSucursal(null);
  201.             }
  202.         }
  203.         return $this;
  204.     }
  205.     public function getImage(): ?string
  206.     {
  207.         return $this->image;
  208.     }
  209.     public function setImage(?string $image): self
  210.     {
  211.         $this->image $image;
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return File|null
  216.      */
  217.     public function getImageFile(): ?File
  218.     {
  219.         return $this->imageFile;
  220.     }
  221.     /**
  222.      * @param File|null $imageFile
  223.      */
  224.     public function setImageFile(?File $imageFile): void
  225.     {
  226.         $this->imageFile $imageFile;
  227.         if ($imageFile !== null) {
  228.             $this->updatedDate = new \DateTimeImmutable();
  229.         }
  230.     }
  231.     public function getExternal(): ?int
  232.     {
  233.         return $this->external;
  234.     }
  235.     public function setExternal(?int $external): self
  236.     {
  237.         $this->external $external;
  238.         return $this;
  239.     }
  240.     public function getNumeroCasa(): ?string
  241.     {
  242.         return $this->numeroCasa;
  243.     }
  244.     public function setNumeroCasa(string $numeroCasa): static
  245.     {
  246.         $this->numeroCasa $numeroCasa;
  247.         return $this;
  248.     }
  249.     public function getComplementoDireccion1(): ?string
  250.     {
  251.         return $this->complementoDireccion1;
  252.     }
  253.     public function setComplementoDireccion1(?string $complementoDireccion1): static
  254.     {
  255.         $this->complementoDireccion1 $complementoDireccion1;
  256.         return $this;
  257.     }
  258.     public function getComplementoDireccion2(): ?string
  259.     {
  260.         return $this->complementoDireccion2;
  261.     }
  262.     public function setComplementoDireccion2(?string $complementoDireccion2): static
  263.     {
  264.         $this->complementoDireccion2 $complementoDireccion2;
  265.         return $this;
  266.     }
  267.     public function getDepartamento(): ?int
  268.     {
  269.         return $this->departamento;
  270.     }
  271.     public function setDepartamento(int $departamento): static
  272.     {
  273.         $this->departamento $departamento;
  274.         return $this;
  275.     }
  276.     public function getDepartamentoDescripcion(): ?string
  277.     {
  278.         return $this->departamentoDescripcion;
  279.     }
  280.     public function setDepartamentoDescripcion(string $departamentoDescripcion): static
  281.     {
  282.         $this->departamentoDescripcion $departamentoDescripcion;
  283.         return $this;
  284.     }
  285.     public function getDistrito(): ?int
  286.     {
  287.         return $this->distrito;
  288.     }
  289.     public function setDistrito(int $distrito): static
  290.     {
  291.         $this->distrito $distrito;
  292.         return $this;
  293.     }
  294.     public function getDistritoDescripcion(): ?string
  295.     {
  296.         return $this->distritoDescripcion;
  297.     }
  298.     public function setDistritoDescripcion(string $distritoDescripcion): static
  299.     {
  300.         $this->distritoDescripcion $distritoDescripcion;
  301.         return $this;
  302.     }
  303.     public function getCiudad(): ?int
  304.     {
  305.         return $this->ciudad;
  306.     }
  307.     public function setCiudad(int $ciudad): static
  308.     {
  309.         $this->ciudad $ciudad;
  310.         return $this;
  311.     }
  312.     public function getCiudadDescripcion(): ?string
  313.     {
  314.         return $this->ciudadDescripcion;
  315.     }
  316.     public function setCiudadDescripcion(string $ciudadDescripcion): static
  317.     {
  318.         $this->ciudadDescripcion $ciudadDescripcion;
  319.         return $this;
  320.     }
  321.     public function getDenominacion(): ?string
  322.     {
  323.         return $this->denominacion;
  324.     }
  325.     public function setDenominacion(?string $denominacion): static
  326.     {
  327.         $this->denominacion $denominacion;
  328.         return $this;
  329.     }
  330.     /**
  331.      * @return Collection<int, SriPayment>
  332.      */
  333.     public function getSriPayments(): Collection
  334.     {
  335.         return $this->sriPayments;
  336.     }
  337.     public function addSriPayment(SriPayment $sriPayment): static
  338.     {
  339.         if (!$this->sriPayments->contains($sriPayment)) {
  340.             $this->sriPayments->add($sriPayment);
  341.             $sriPayment->setSucursal($this);
  342.         }
  343.         return $this;
  344.     }
  345.     public function removeSriPayment(SriPayment $sriPayment): static
  346.     {
  347.         if ($this->sriPayments->removeElement($sriPayment)) {
  348.             // set the owning side to null (unless already changed)
  349.             if ($sriPayment->getSucursal() === $this) {
  350.                 $sriPayment->setSucursal(null);
  351.             }
  352.         }
  353.         return $this;
  354.     }
  355.     /**
  356.      * @return Collection<int, PaymentCredit>
  357.      */
  358.     public function getPaymentCredits(): Collection
  359.     {
  360.         return $this->paymentCredits;
  361.     }
  362.     public function addPaymentCredit(PaymentCredit $paymentCredit): static
  363.     {
  364.         if (!$this->paymentCredits->contains($paymentCredit)) {
  365.             $this->paymentCredits->add($paymentCredit);
  366.             $paymentCredit->setSucursal($this);
  367.         }
  368.         return $this;
  369.     }
  370.     public function removePaymentCredit(PaymentCredit $paymentCredit): static
  371.     {
  372.         if ($this->paymentCredits->removeElement($paymentCredit)) {
  373.             // set the owning side to null (unless already changed)
  374.             if ($paymentCredit->getSucursal() === $this) {
  375.                 $paymentCredit->setSucursal(null);
  376.             }
  377.         }
  378.         return $this;
  379.     }
  380.     public function getUpdatedDate(): ?\DateTimeInterface
  381.     {
  382.         return $this->updatedDate;
  383.     }
  384.     public function setUpdatedDate(?\DateTimeInterface $updatedDate): static
  385.     {
  386.         $this->updatedDate $updatedDate;
  387.         return $this;
  388.     }
  389.     function getSriInfo()
  390.     {
  391.         return $this->getCompany();
  392.     }
  393. }