src/Entity/Check.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Club1895\TransactionCheck as Club1895TransactionCheck;
  4. use App\Entity\Traits\Timestampable;
  5. use App\Repository\CheckRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassCheckRepository::class)]
  10. #[ORM\Table(name'payment_check')]
  11. class Check implements CancellableInterface
  12. {
  13.     use Timestampable;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type'integer')]
  17.     private $id;
  18.     #[ORM\OneToMany(mappedBy'check'targetEntityTransactionCheck::class)]
  19.     private $transactionChecks;
  20.     #[ORM\Column(type'string'length255nullabletrue)]
  21.     private $bank;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $drawer;
  24.     #[ORM\Column(type'float')]
  25.     private $amount;
  26.     #[ORM\ManyToOne(targetEntityEnvelope::class, inversedBy'checks')]
  27.     private $envelope;
  28.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'children')]
  29.     private $parent;
  30.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class)]
  31.     private $children;
  32.     #[ORM\Column(type'string'length255)]
  33.     private $number;
  34.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  35.     private $date;
  36.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  37.     private $isCancelled false;
  38.     #[ORM\OneToMany(mappedBy'check'targetEntityBenefactorTransactionCheck::class)]
  39.     private Collection $benefactorTransactionChecks;
  40.     #[ORM\OneToMany(mappedBy'check'targetEntityClub1895TransactionCheck::class)]
  41.     private Collection $club1895TransactionChecks;
  42.     public function __construct()
  43.     {
  44.         $this->transactionChecks = new ArrayCollection();
  45.         $this->children = new ArrayCollection();
  46.         $this->benefactorTransactionChecks = new ArrayCollection();
  47.         $this->club1895TransactionChecks = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     /**
  54.      * @return Collection<int, TransactionCheck>
  55.      */
  56.     public function getTransactionChecks(): Collection
  57.     {
  58.         return $this->transactionChecks;
  59.     }
  60.     public function addTransactionCheck(TransactionCheck $transactionCheck): self
  61.     {
  62.         if (!$this->transactionChecks->contains($transactionCheck)) {
  63.             $this->transactionChecks[] = $transactionCheck;
  64.             $transactionCheck->setCheck($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeTransactionCheck(TransactionCheck $transactionCheck): self
  69.     {
  70.         if ($this->transactionChecks->removeElement($transactionCheck)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($transactionCheck->getCheck() === $this) {
  73.                 $transactionCheck->setCheck(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78.     public function getBank(): ?string
  79.     {
  80.         return $this->bank;
  81.     }
  82.     public function setBank(?string $bank): self
  83.     {
  84.         $this->bank $bank;
  85.         return $this;
  86.     }
  87.     public function getDrawer(): ?string
  88.     {
  89.         return $this->drawer;
  90.     }
  91.     public function setDrawer(?string $drawer): self
  92.     {
  93.         $this->drawer $drawer;
  94.         return $this;
  95.     }
  96.     public function getAmount(): ?float
  97.     {
  98.         return $this->amount;
  99.     }
  100.     public function setAmount(float $amount): self
  101.     {
  102.         $this->amount $amount;
  103.         return $this;
  104.     }
  105.     public function getEnvelope(): ?Envelope
  106.     {
  107.         return $this->envelope ?? $this->getParent()?->getEnvelope();
  108.     }
  109.     public function setEnvelope(?Envelope $envelope): self
  110.     {
  111.         $this->envelope $envelope;
  112.         return $this;
  113.     }
  114.     public function getParent(): ?self
  115.     {
  116.         return $this->parent;
  117.     }
  118.     public function setParent(?self $parent): self
  119.     {
  120.         $this->parent $parent;
  121.         return $this;
  122.     }
  123.     /**
  124.      * @return Collection<int, self>
  125.      */
  126.     public function getChildren(): Collection
  127.     {
  128.         return $this->children;
  129.     }
  130.     public function addChild(self $child): self
  131.     {
  132.         if (!$this->children->contains($child)) {
  133.             $this->children[] = $child;
  134.             $child->setParent($this);
  135.         }
  136.         return $this;
  137.     }
  138.     public function removeChild(self $child): self
  139.     {
  140.         if ($this->children->removeElement($child)) {
  141.             // set the owning side to null (unless already changed)
  142.             if ($child->getParent() === $this) {
  143.                 $child->setParent(null);
  144.             }
  145.         }
  146.         return $this;
  147.     }
  148.     public function getNumber(): ?string
  149.     {
  150.         return $this->number;
  151.     }
  152.     public function setNumber(string $number): self
  153.     {
  154.         $this->number $number;
  155.         return $this;
  156.     }
  157.     public function getDate(): ?\DateTimeImmutable
  158.     {
  159.         return $this->date;
  160.     }
  161.     public function setDate(?\DateTimeImmutable $date): self
  162.     {
  163.         $this->date $date;
  164.         return $this;
  165.     }
  166.     public function isIsCancelled(): ?bool
  167.     {
  168.         return $this->isCancelled;
  169.     }
  170.     public function setIsCancelled(bool $isCancelled): self
  171.     {
  172.         $this->isCancelled $isCancelled;
  173.         return $this;
  174.     }
  175.     public function getCancelReason(): ?string
  176.     {
  177.         $transaction $this->getTransactionChecks()->first();
  178.         if ($transaction) {
  179.             return $transaction->getCancelReason();
  180.         }
  181.         return null;
  182.     }
  183.     /**
  184.      * @return Collection<int, BenefactorTransactionCheck>
  185.      */
  186.     public function getBenefactorTransactionChecks(): Collection
  187.     {
  188.         return $this->benefactorTransactionChecks;
  189.     }
  190.     public function addBenefactorTransactionCheck(BenefactorTransactionCheck $benefactorTransactionCheck): self
  191.     {
  192.         if (!$this->benefactorTransactionChecks->contains($benefactorTransactionCheck)) {
  193.             $this->benefactorTransactionChecks->add($benefactorTransactionCheck);
  194.             $benefactorTransactionCheck->setCheck($this);
  195.         }
  196.         return $this;
  197.     }
  198.     public function removeBenefactorTransactionCheck(BenefactorTransactionCheck $benefactorTransactionCheck): self
  199.     {
  200.         if ($this->benefactorTransactionChecks->removeElement($benefactorTransactionCheck)) {
  201.             // set the owning side to null (unless already changed)
  202.             if ($benefactorTransactionCheck->getCheck() === $this) {
  203.                 $benefactorTransactionCheck->setCheck(null);
  204.             }
  205.         }
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, TransactionCheck>
  210.      */
  211.     public function getClub1895TransactionChecks(): Collection
  212.     {
  213.         return $this->club1895TransactionChecks;
  214.     }
  215.     public function addClub1895TransactionCheck(TransactionCheck $club1895TransactionCheck): self
  216.     {
  217.         if (!$this->club1895TransactionChecks->contains($club1895TransactionCheck)) {
  218.             $this->club1895TransactionChecks->add($club1895TransactionCheck);
  219.             $club1895TransactionCheck->setCheck($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeClub1895TransactionCheck(TransactionCheck $club1895TransactionCheck): self
  224.     {
  225.         if ($this->club1895TransactionChecks->removeElement($club1895TransactionCheck)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($club1895TransactionCheck->getCheck() === $this) {
  228.                 $club1895TransactionCheck->setCheck(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233. }