src/Entity/Invoice.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\Invoice\Status;
  4. use App\Repository\InvoiceRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=InvoiceRepository::class)
  8.  */
  9. class Invoice
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="datetime")
  19.      */
  20.     private $createdAt;
  21.     /**
  22.      * @ORM\Column(type="enum", options={"values"="invoice_enum", "default"="new"})
  23.      */
  24.     private $status Status::STATUS_NEW;
  25.     /**
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $amount;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=Candidate::class)
  31.      * @ORM\JoinColumn(nullable=false)
  32.      */
  33.     private $candidate;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=FinanceCategory::class)
  36.      * @ORM\JoinColumn(nullable=true)
  37.      */
  38.     private $financeCategory;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=Person::class)
  41.      * @ORM\JoinColumn(nullable=true)
  42.      */
  43.     private $person;
  44.     public function __construct()
  45.     {
  46.         $this->createdAt = new \DateTime();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getCreatedAt(): ?\DateTimeInterface
  53.     {
  54.         return $this->createdAt;
  55.     }
  56.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  57.     {
  58.         $this->createdAt $createdAt;
  59.         return $this;
  60.     }
  61.     public function getStatus()
  62.     {
  63.         return $this->status;
  64.     }
  65.     public function setStatus($status): self
  66.     {
  67.         $this->status $status;
  68.         return $this;
  69.     }
  70.     public function getStatusText(): string
  71.     {
  72.         return Status::getText($this->status);
  73.     }
  74.     public function getStatusCssClass($prefix null): string
  75.     {
  76.         return Status::getCssClass($this->status$prefix);
  77.     }
  78.     public function getAmount(): ?int
  79.     {
  80.         return $this->amount;
  81.     }
  82.     public function setAmount(int $amount): self
  83.     {
  84.         $this->amount $amount;
  85.         return $this;
  86.     }
  87.     public function getCandidate(): ?Candidate
  88.     {
  89.         return $this->candidate;
  90.     }
  91.     public function setCandidate(?Candidate $candidate): self
  92.     {
  93.         $this->candidate $candidate;
  94.         return $this;
  95.     }
  96.     public function getFinanceCategory(): ?FinanceCategory
  97.     {
  98.         return $this->financeCategory;
  99.     }
  100.     public function setFinanceCategory(?FinanceCategory $financeCategory): self
  101.     {
  102.         $this->financeCategory $financeCategory;
  103.         return $this;
  104.     }
  105.     public function getPerson(): ?Person
  106.     {
  107.         return $this->person;
  108.     }
  109.     public function setPerson(?Person $person): self
  110.     {
  111.         $this->person $person;
  112.         return $this;
  113.     }
  114. }