vendor/bluue/sales-bundle/src/Entity/DocumentPayment.php line 30

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Quentin CHATELAIN (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\SalesBundle\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Uid\Uuid;
  11. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  12. use Gedmo\Mapping\Annotation as Gedmo;
  13. use Bluue\SalesBundle\Repository\DocumentPaymentRepository;
  14. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  15. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  16. /**
  17.  * @ORM\Entity(repositoryClass=DocumentPaymentRepository::class)
  18.  * @ORM\Table(name="sales_bundle__document_payment", indexes={
  19.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  20.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  21.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  22.  * })
  23.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  24.  */
  25. class DocumentPayment
  26. {
  27.     use UserTimestampableEntity;
  28.     use UserSoftDeleteableEntity;
  29.     /**
  30.      * @ORM\Id
  31.      * @ORM\Column(type="uuid")
  32.      * @ORM\GeneratedValue(strategy="CUSTOM")
  33.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  34.      */
  35.     private ?Uuid $id null;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Payment::class, inversedBy="document_payments")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private ?Payment $payment null;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity=Invoice::class, inversedBy="payments")
  43.      */
  44.     private ?Invoice $invoice null;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity=CreditNote::class, inversedBy="payments")
  47.      */
  48.     private ?CreditNote $credit_note null;
  49.     /**
  50.      * @ORM\Column(type="decimal", precision=20, scale=6, nullable="true")
  51.      */
  52.     private ?string $amount null;
  53.     /**
  54.      * @return Uuid|null
  55.      */
  56.     public function getId(): ?Uuid
  57.     {
  58.         return $this->id;
  59.     }
  60.     /**
  61.      * @return Payment|null
  62.      */
  63.     public function getPayment(): ?Payment
  64.     {
  65.         return $this->payment;
  66.     }
  67.     /**
  68.      * @param Payment|null $payment
  69.      * @return DocumentPayment
  70.      */
  71.     public function setPayment(?Payment $payment): self
  72.     {
  73.         $this->payment $payment;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Invoice|null
  78.      */
  79.     public function getInvoice(): ?Invoice
  80.     {
  81.         return $this->invoice;
  82.     }
  83.     /**
  84.      * @param Invoice|null $invoice
  85.      * @return DocumentPayment
  86.      */
  87.     public function setInvoice(?Invoice $invoice): self
  88.     {
  89.         $this->invoice $invoice;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return CreditNote|null
  94.      */
  95.     public function getCreditNote(): ?CreditNote
  96.     {
  97.         return $this->credit_note;
  98.     }
  99.     /**
  100.      * @param CreditNote|null $credit_note
  101.      * @return DocumentPayment
  102.      */
  103.     public function setCreditNote(?CreditNote $credit_note): self
  104.     {
  105.         $this->credit_note $credit_note;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return string|null
  110.      */
  111.     public function getAmount(): ?string
  112.     {
  113.         return $this->amount;
  114.     }
  115.     /**
  116.      * @param string|null $amount
  117.      * @return DocumentPayment
  118.      */
  119.     public function setAmount(?string $amount): self
  120.     {
  121.         $this->amount $amount;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Invoice|CreditNote|null
  126.      */
  127.     public function getDocument()
  128.     {
  129.         return $this->getInvoice() ?? $this->getCreditNote();
  130.     }
  131. }