src/Flexy/ShopBundle/Entity/Payment/BankBookItem.php line 16
<?php
namespace App\Flexy\ShopBundle\Entity\Payment;
use ApiPlatform\Metadata\ApiResource;
use App\Flexy\ShopBundle\Entity\Customer\Customer;
use App\Flexy\ShopBundle\Entity\Shipping\CashOnDelivery;
use App\Repository\Flexy\ShopBundle\Entity\Payment\BankBookItemRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BankBookItemRepository::class)]
#[ApiResource]
class BankBookItem
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'bankBookItems')]
private ?Customer $customer = null;
#[ORM\Column]
private ?float $amount = null;
#[ORM\Column]
private ?int $reference = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $createdBy = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $updatedBy = null;
#[ORM\ManyToOne(inversedBy: 'bankBookItems')]
private ?BankBook $bankBook = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Transaction $transaction = null;
#[ORM\OneToMany(mappedBy: 'bankBookItem', targetEntity: CashOnDelivery::class)]
private Collection $cashOnDeliveries;
public function __construct()
{
$this->cashOnDeliveries = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
public function getReference(): ?int
{
return $this->reference;
}
public function setReference(int $reference): self
{
$this->reference = $reference;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy(): ?string
{
return $this->createdBy;
}
public function setCreatedBy(?string $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedBy(): ?string
{
return $this->updatedBy;
}
public function setUpdatedBy(?string $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getBankBook(): ?BankBook
{
return $this->bankBook;
}
public function setBankBook(?BankBook $bankBook): self
{
$this->bankBook = $bankBook;
return $this;
}
public function getTransaction(): ?Transaction
{
return $this->transaction;
}
public function setTransaction(?Transaction $transaction): self
{
$this->transaction = $transaction;
return $this;
}
/**
* @return Collection<int, CashOnDelivery>
*/
public function getCashOnDeliveries(): Collection
{
return $this->cashOnDeliveries;
}
public function addCashOnDelivery(CashOnDelivery $cashOnDelivery): self
{
if (!$this->cashOnDeliveries->contains($cashOnDelivery)) {
$this->cashOnDeliveries->add($cashOnDelivery);
$cashOnDelivery->setBankBookItem($this);
}
return $this;
}
public function removeCashOnDelivery(CashOnDelivery $cashOnDelivery): self
{
if ($this->cashOnDeliveries->removeElement($cashOnDelivery)) {
// set the owning side to null (unless already changed)
if ($cashOnDelivery->getBankBookItem() === $this) {
$cashOnDelivery->setBankBookItem(null);
}
}
return $this;
}
}