src/Entity/Payment.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PaymentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Enum\Payment\Type as PaymentType;
  6. /**
  7.  * @ORM\Entity(repositoryClass=PaymentRepository::class)
  8.  */
  9. class Payment
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $amount;
  21.     /**
  22.      * @ORM\Column(type="datetime")
  23.      */
  24.     private $createdAt;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=CalendarEvent::class)
  27.      */
  28.     private $calendarEvent;
  29.     /**
  30.      * @ORM\Column(type="text", nullable=true)
  31.      */
  32.     private $comment;
  33.     /**
  34.      * @ORM\Column(type="datetime")
  35.      */
  36.     private $dateTime;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity=User::class)
  39.      * @ORM\JoinColumn(nullable=false)
  40.      */
  41.     private $createdBy;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Person::class)
  44.      * @ORM\JoinColumn(nullable=false)
  45.      */
  46.     private $person;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $receiptFile;
  51.     /**
  52.      * @var string
  53.      */
  54.     private $newReceiptFile;
  55.     /**
  56.      * @ORM\Column(type="enum", nullable=true, options={"values"="payment_enum"})
  57.      */
  58.     private $type;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=FinanceCategory::class)
  61.      * @ORM\JoinColumn(nullable=true)
  62.      */
  63.     private $financeCategory;
  64.     /**
  65.      * @ORM\OneToOne(targetEntity=Transaction::class, inversedBy="payment", cascade={"persist", "remove"})
  66.      */
  67.     private $transaction;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private $bankStatementRowMd5;
  72.     /**
  73.      * @ORM\Column(type="integer", nullable=true)
  74.      */
  75.     private $bankStatementAmount;
  76.     public function __construct()
  77.     {
  78.         $this->createdAt = new \DateTime();
  79.         // $this->dateTime = new \DateTime();
  80.     }
  81.     public function getId(): ?int
  82.     {
  83.         return $this->id;
  84.     }
  85.     public function getAmount(): ?int
  86.     {
  87.         return $this->amount;
  88.     }
  89.     public function setAmount(int $amount): self
  90.     {
  91.         $this->amount $amount;
  92.         return $this;
  93.     }
  94.     public function getCreatedAt(): ?\DateTimeInterface
  95.     {
  96.         return $this->createdAt;
  97.     }
  98.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  99.     {
  100.         $this->createdAt $createdAt;
  101.         return $this;
  102.     }
  103.     public function getCalendarEvent(): ?CalendarEvent
  104.     {
  105.         return $this->calendarEvent;
  106.     }
  107.     public function setCalendarEvent(?CalendarEvent $calendarEvent): self
  108.     {
  109.         if ($calendarEvent && !$calendarEvent->getFinanceCategory()) {
  110.             throw new \InvalidArgumentException('Невозможно создать платеж. В мероприятии не указана статья финансов. Обратитесь к администратору.');
  111.         }
  112.         $this->calendarEvent $calendarEvent;
  113.         $this->setFinanceCategory($calendarEvent $calendarEvent->getFinanceCategory() : null);
  114.         return $this;
  115.     }
  116.     public function getComment(): ?string
  117.     {
  118.         return $this->comment;
  119.     }
  120.     public function setComment(?string $comment): self
  121.     {
  122.         $this->comment $comment;
  123.         return $this;
  124.     }
  125.     public function getDateTime(): ?\DateTimeInterface
  126.     {
  127.         return $this->dateTime;
  128.     }
  129.     public function setDateTime(\DateTimeInterface $dateTime): self
  130.     {
  131.         $this->dateTime $dateTime;
  132.         return $this;
  133.     }
  134.     public function getCreatedBy(): ?User
  135.     {
  136.         return $this->createdBy;
  137.     }
  138.     public function setCreatedBy(?User $createdBy): self
  139.     {
  140.         $this->createdBy $createdBy;
  141.         return $this;
  142.     }
  143.     public function getPerson(): ?Person
  144.     {
  145.         return $this->person;
  146.     }
  147.     public function setPerson(?Person $person): self
  148.     {
  149.         $this->person $person;
  150.         return $this;
  151.     }
  152.     public function getReceiptFile(): ?string
  153.     {
  154.         return $this->receiptFile;
  155.     }
  156.     public function setReceiptFile(?string $receiptFile): self
  157.     {
  158.         $this->receiptFile $receiptFile;
  159.         return $this;
  160.     }
  161.     public function getNewReceiptFile(): ?string
  162.     {
  163.         return $this->newReceiptFile;
  164.     }
  165.     public function setNewReceiptFile(?string $newReceiptFile): self
  166.     {
  167.         $this->newReceiptFile $newReceiptFile;
  168.         return $this;
  169.     }
  170.     public function getType()
  171.     {
  172.         return $this->type;
  173.     }
  174.     public function setType($type): self
  175.     {
  176.         $this->type $type;
  177.         return $this;
  178.     }
  179.     public function getTypeText(): ?string
  180.     {
  181.         return PaymentType::getText($this->getType());
  182.     }
  183.     public function getTypeCssClass($prefix null): ?string
  184.     {
  185.         return PaymentType::getCssClass($this->getType(), $prefix);
  186.     }
  187.     public function getFinanceCategory(): ?FinanceCategory
  188.     {
  189.         return $this->financeCategory;
  190.     }
  191.     public function setFinanceCategory(?FinanceCategory $financeCategory): self
  192.     {
  193.         $this->financeCategory $financeCategory;
  194.         return $this;
  195.     }
  196.     public function getTransaction(): ?Transaction
  197.     {
  198.         return $this->transaction;
  199.     }
  200.     public function setTransaction(?Transaction $transaction): self
  201.     {
  202.         $this->transaction $transaction;
  203.         return $this;
  204.     }
  205.     public function getBankStatementRowMd5(): ?string
  206.     {
  207.         return $this->bankStatementRowMd5;
  208.     }
  209.     public function setBankStatementRowMd5(?string $bankStatementRowMd5): self
  210.     {
  211.         $this->bankStatementRowMd5 $bankStatementRowMd5;
  212.         return $this;
  213.     }
  214.     public function getBankStatementAmount(): ?int
  215.     {
  216.         return $this->bankStatementAmount;
  217.     }
  218.     public function setBankStatementAmount(int $bankStatementAmount): self
  219.     {
  220.         $this->bankStatementAmount $bankStatementAmount;
  221.         return $this;
  222.     }
  223. }