src/Flexy/ShopBundle/Entity/Payment/BankBookItem.php line 16

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Payment;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  5. use App\Flexy\ShopBundle\Entity\Shipping\CashOnDelivery;
  6. use App\Repository\Flexy\ShopBundle\Entity\Payment\BankBookItemRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassBankBookItemRepository::class)]
  12. #[ApiResource]
  13. class BankBookItem
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\ManyToOne(inversedBy'bankBookItems')]
  20.     private ?Customer $customer null;
  21.     #[ORM\Column]
  22.     private ?float $amount null;
  23.     #[ORM\Column]
  24.     private ?int $reference null;
  25.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  26.     private ?string $description null;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $createdAt null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $createdBy null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $updatedBy null;
  33.     #[ORM\ManyToOne(inversedBy'bankBookItems')]
  34.     private ?BankBook $bankBook null;
  35.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  36.     private ?Transaction $transaction null;
  37.     #[ORM\OneToMany(mappedBy'bankBookItem'targetEntityCashOnDelivery::class)]
  38.     private Collection $cashOnDeliveries;
  39.     public function __construct()
  40.     {
  41.         $this->cashOnDeliveries = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getCustomer(): ?Customer
  48.     {
  49.         return $this->customer;
  50.     }
  51.     public function setCustomer(?Customer $customer): self
  52.     {
  53.         $this->customer $customer;
  54.         return $this;
  55.     }
  56.     public function getAmount(): ?float
  57.     {
  58.         return $this->amount;
  59.     }
  60.     public function setAmount(float $amount): self
  61.     {
  62.         $this->amount $amount;
  63.         return $this;
  64.     }
  65.     public function getReference(): ?int
  66.     {
  67.         return $this->reference;
  68.     }
  69.     public function setReference(int $reference): self
  70.     {
  71.         $this->reference $reference;
  72.         return $this;
  73.     }
  74.     public function getDescription(): ?string
  75.     {
  76.         return $this->description;
  77.     }
  78.     public function setDescription(?string $description): self
  79.     {
  80.         $this->description $description;
  81.         return $this;
  82.     }
  83.     public function getCreatedAt(): ?\DateTimeInterface
  84.     {
  85.         return $this->createdAt;
  86.     }
  87.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  88.     {
  89.         $this->createdAt $createdAt;
  90.         return $this;
  91.     }
  92.     public function getCreatedBy(): ?string
  93.     {
  94.         return $this->createdBy;
  95.     }
  96.     public function setCreatedBy(?string $createdBy): self
  97.     {
  98.         $this->createdBy $createdBy;
  99.         return $this;
  100.     }
  101.     public function getUpdatedBy(): ?string
  102.     {
  103.         return $this->updatedBy;
  104.     }
  105.     public function setUpdatedBy(?string $updatedBy): self
  106.     {
  107.         $this->updatedBy $updatedBy;
  108.         return $this;
  109.     }
  110.     public function getBankBook(): ?BankBook
  111.     {
  112.         return $this->bankBook;
  113.     }
  114.     public function setBankBook(?BankBook $bankBook): self
  115.     {
  116.         $this->bankBook $bankBook;
  117.         return $this;
  118.     }
  119.     public function getTransaction(): ?Transaction
  120.     {
  121.         return $this->transaction;
  122.     }
  123.     public function setTransaction(?Transaction $transaction): self
  124.     {
  125.         $this->transaction $transaction;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, CashOnDelivery>
  130.      */
  131.     public function getCashOnDeliveries(): Collection
  132.     {
  133.         return $this->cashOnDeliveries;
  134.     }
  135.     public function addCashOnDelivery(CashOnDelivery $cashOnDelivery): self
  136.     {
  137.         if (!$this->cashOnDeliveries->contains($cashOnDelivery)) {
  138.             $this->cashOnDeliveries->add($cashOnDelivery);
  139.             $cashOnDelivery->setBankBookItem($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeCashOnDelivery(CashOnDelivery $cashOnDelivery): self
  144.     {
  145.         if ($this->cashOnDeliveries->removeElement($cashOnDelivery)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($cashOnDelivery->getBankBookItem() === $this) {
  148.                 $cashOnDelivery->setBankBookItem(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153. }