src/Entity/PaymentCredit.php line 21
<?php/** @author Guerby Duval <info@tranzaksyon.com>* @link https://tranzaksyon.com* @copyright You are not allowed to remove this author "Guerby Duval <info@tranzaksyon.com>", the link "https://tranzaksyon.com" neither this copyright.*/namespace App\Entity;use App\Repository\PaymentCreditRepository;use App\Utils\Sri\SriData;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints\NotBlank;use Symfony\Component\Validator\Constraints\Valid;use Symfony\Component\Validator\Constraints\When;#[ORM\Entity(repositoryClass: PaymentCreditRepository::class)]class PaymentCredit{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['payment_credit_out'])]private ?int $id = null;#[ORM\Column]#[NotBlank(message: "Ingrese condición de la operación")]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?int $condicionOperacion = null;#[ORM\Column(length: 20)]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?string $descripcionCondicionOperacion = null;#[ORM\Column(length: 15, nullable: true)]#[When('this.getCondicionOperacion() === 1', [new NotBlank(),])]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?string $plazo = null;#[ORM\Column(nullable: true)]#[When('this.getCondicionOperacion() === 2', [new NotBlank(),])]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?int $quoteAmount = null;#[ORM\ManyToOne(inversedBy: 'paymentCredits')]#[ORM\JoinColumn(nullable: false)]private ?SriInfo $company = null;#[ORM\OneToOne(mappedBy: 'paymentCredit', cascade: ['persist', 'remove'])]private ?Invoice $invoice = null;#[ORM\ManyToOne(inversedBy: 'paymentCredits')]private ?Sucursal $sucursal = null;#[ORM\Column(length: 15, nullable: true)]#[When('this.getCondicionOperacion() === 1', [new NotBlank(),])]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?string $periodPlazo = null;#[ORM\OneToMany(mappedBy: 'credit', targetEntity: PaymentCreditQuote::class, cascade: ['persist', 'remove'], orphanRemoval: true)]#[Valid]#[Groups(['payment_credit_out', 'payment_credit_in'])]private Collection $quotes;#[ORM\ManyToOne(targetEntity: SriPayment::class, cascade: ['persist', 'remove'], inversedBy: 'paymentCredits')]#[Valid]#[Groups(['payment_credit_out', 'payment_credit_in'])]private ?SriPayment $sriPayment = null;public function __construct(){$this->quotes = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getCondicionOperacion(): ?int{return $this->condicionOperacion;}public function setCondicionOperacion(?int $condicionOperacion): static{$this->condicionOperacion = $condicionOperacion;return $this;}public function getDescripcionCondicionOperacion(): ?string{return $this->descripcionCondicionOperacion;}public function setDescripcionCondicionOperacion(?string $descripcionCondicionOperacion): static{$this->descripcionCondicionOperacion = $descripcionCondicionOperacion;return $this;}public function getPlazo(): ?string{return $this->plazo;}public function setPlazo(?string $plazo): static{$this->plazo = $plazo;return $this;}public function getQuoteAmount(): ?int{return $this->quoteAmount;}public function setQuoteAmount(?int $quoteAmount): static{$this->quoteAmount = $quoteAmount;return $this;}public function getCompany(): ?SriInfo{return $this->company;}public function setCompany(?SriInfo $company): static{$this->company = $company;return $this;}public function getInvoice(): ?Invoice{return $this->invoice;}public function setInvoice(?Invoice $invoice): static{// unset the owning side of the relation if necessaryif ($invoice === null && $this->invoice !== null) {$this->invoice->setPaymentCredit(null);}// set the owning side of the relation if necessaryif ($invoice !== null && $invoice->getPaymentCredit() !== $this) {$invoice->setPaymentCredit($this);}$this->invoice = $invoice;return $this;}public function getSucursal(): ?Sucursal{return $this->sucursal;}public function setSucursal(?Sucursal $sucursal): static{$this->sucursal = $sucursal;return $this;}public function getPeriodPlazo(): ?string{return $this->periodPlazo;}public function getPeriodPlazoDescription(): ?string{return array_flip(SriData::PLAZO_PERIODS)[$this->periodPlazo];}public function setPeriodPlazo(?string $periodPlazo): static{$this->periodPlazo = $periodPlazo;return $this;}/*** @return Collection<int, PaymentCreditQuote>*/public function getQuotes(): Collection{return $this->quotes;}public function addQuote(PaymentCreditQuote $quote): static{if (!$this->quotes->contains($quote)) {$this->quotes->add($quote);$quote->setCredit($this);}return $this;}public function removeQuote(PaymentCreditQuote $quote): static{if ($this->quotes->removeElement($quote)) {// set the owning side to null (unless already changed)if ($quote->getCredit() === $this) {$quote->setCredit(null);}}return $this;}public function getSriPayment(): ?SriPayment{return $this->sriPayment;}public function setSriPayment(?SriPayment $sriPayment): static{$this->sriPayment = $sriPayment;return $this;}}