src/Entity/SriPayment.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SriPaymentRepository;
  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\Serializer\Annotation\Groups;
  9. use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
  10. use Symfony\Component\Validator\Constraints\NotBlank;
  11. use Symfony\Component\Validator\Constraints\NotNull;
  12. use Symfony\Component\Validator\Constraints\Valid;
  13. #[ORM\Entity(repositoryClassSriPaymentRepository::class)]
  14. class SriPayment
  15. {
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length2)]
  21.     #[NotBlank]
  22.     #[Groups(['sri_payment_out''sri_payment_in'])]
  23.     private ?string $paymentForm null;
  24.     #[ORM\Column(typeTypes::DECIMALprecision20scale6)]
  25.     #[NotNull]
  26.     #[GreaterThanOrEqual(0.01)]
  27.     #[Groups(['sri_payment_out''sri_payment_in'])]
  28.     private ?string $total null;
  29.     #[ORM\ManyToOne(inversedBy'sriPayments')]
  30.     private ?Invoice $invoice null;
  31.     #[ORM\OneToOne(inversedBy'sriPayment'cascade: ['persist''remove'], orphanRemovaltrue)]
  32.     #[Valid]
  33.     #[Groups(['sri_payment_out''sri_payment_in'])]
  34.     private ?PaymentCreditDebitCard $creditCard null;
  35.     #[ORM\OneToOne(inversedBy'sriPayment'cascade: ['persist''remove'])]
  36.     #[Valid]
  37.     #[Groups(['sri_payment_out''sri_payment_in'])]
  38.     private ?PaymentCheck $checkPayment null;
  39.     #[ORM\ManyToOne(inversedBy'sriPayments')]
  40.     private ?SriInfo $company null;
  41.     #[ORM\ManyToOne(inversedBy'sriPayments')]
  42.     private ?Sucursal $sucursal null;
  43.     #[ORM\OneToMany(mappedBy'sriPayment'targetEntityPaymentCredit::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  44.     private Collection $paymentCredits;
  45.     public function __construct()
  46.     {
  47.         $this->paymentCredits = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getPaymentForm(): ?string
  54.     {
  55.         return $this->paymentForm;
  56.     }
  57.     public function setPaymentForm(?string $paymentForm): self
  58.     {
  59.         $this->paymentForm $paymentForm;
  60.         return $this;
  61.     }
  62.     public function getTotal(): ?string
  63.     {
  64.         return $this->total;
  65.     }
  66.     public function setTotal(?string $total): self
  67.     {
  68.         $this->total $total;
  69.         return $this;
  70.     }
  71.     public function getInvoice(): ?Invoice
  72.     {
  73.         return $this->invoice;
  74.     }
  75.     public function setInvoice(?Invoice $invoice): static
  76.     {
  77.         $this->invoice $invoice;
  78.         return $this;
  79.     }
  80.     public function getCompanyCard(): ?int
  81.     {
  82.         return $this->companyCard;
  83.     }
  84.     public function setCompanyCard(?int $companyCard): static
  85.     {
  86.         $this->companyCard $companyCard;
  87.         return $this;
  88.     }
  89.     public function getCreditCard(): ?PaymentCreditDebitCard
  90.     {
  91.         return $this->creditCard;
  92.     }
  93.     public function setCreditCard(?PaymentCreditDebitCard $creditCard): static
  94.     {
  95.         $this->creditCard $creditCard;
  96.         return $this;
  97.     }
  98.     public function getCheckPayment(): ?PaymentCheck
  99.     {
  100.         return $this->checkPayment;
  101.     }
  102.     public function setCheckPayment(?PaymentCheck $checkPayment): static
  103.     {
  104.         $this->checkPayment $checkPayment;
  105.         return $this;
  106.     }
  107.     public function getCompany(): ?SriInfo
  108.     {
  109.         return $this->company;
  110.     }
  111.     public function setCompany(?SriInfo $company): static
  112.     {
  113.         $this->company $company;
  114.         return $this;
  115.     }
  116.     public function getSucursal(): ?Sucursal
  117.     {
  118.         return $this->sucursal;
  119.     }
  120.     public function setSucursal(?Sucursal $sucursal): static
  121.     {
  122.         $this->sucursal $sucursal;
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, PaymentCredit>
  127.      */
  128.     public function getPaymentCredits(): Collection
  129.     {
  130.         return $this->paymentCredits;
  131.     }
  132.     public function addPaymentCredit(PaymentCredit $paymentCredit): static
  133.     {
  134.         if (!$this->paymentCredits->contains($paymentCredit)) {
  135.             $this->paymentCredits->add($paymentCredit);
  136.             $paymentCredit->setSriPayment($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removePaymentCredit(PaymentCredit $paymentCredit): static
  141.     {
  142.         if ($this->paymentCredits->removeElement($paymentCredit)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($paymentCredit->getSriPayment() === $this) {
  145.                 $paymentCredit->setSriPayment(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150. }