src/Entity/Report.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Traits\UuidEntityTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Traits\TimestampableEntity;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ORM\Entity()
  9.  */
  10. class Report
  11. {
  12.     use UuidEntityTrait;
  13.     use TimestampableEntity;
  14.     /**
  15.      * @ORM\ManyToOne(targetEntity=ReportType::class, fetch="EAGER")
  16.      * @ORM\JoinColumn(nullable=false)
  17.      */
  18.     #[Groups(['index''orderHistory'])]
  19.     private ?ReportType $reportType;
  20.     /**
  21.      * @ORM\Column(type="text", nullable=true)
  22.      */
  23.     private ?string $content null;
  24.     /**
  25.      * @ORM\Column(type="decimal", precision=10, scale=2)
  26.      */
  27.     #[Groups(['index'])]
  28.     private ?float $price;
  29.     /**
  30.      * @ORM\Column(type="boolean")
  31.      */
  32.     #[Groups(['index''orderHistory'])]
  33.     private bool $loaded false;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     #[Groups(['index'])]
  38.     private bool $handled false;
  39.     /**
  40.      * @ORM\ManyToOne (targetEntity=Order::class, inversedBy="reports", fetch="EAGER")
  41.      * @ORM\JoinColumn(name="order_id", referencedColumnName="id")
  42.      */
  43.     private ?Order $order;
  44.     public function __toString(): string
  45.     {
  46.         return $this->getOrder()?->getId() . '_' .
  47.             $this->getOrder()?->getVin()?->getVin() . '_' .
  48.             $this->getReportType()?->getName() . '_' .
  49.             ($this->getHandled() ? 'Handled' 'NotHandled') . '_' .
  50.             ($this->getLoaded() ? 'Loaded' 'NotLoaded');
  51.     }
  52.     public function getReportType(): ?ReportType
  53.     {
  54.         return $this->reportType;
  55.     }
  56.     public function setReportType(?ReportType $reportType): self
  57.     {
  58.         $this->reportType $reportType;
  59.         return $this;
  60.     }
  61.     public function getContent(): ?string
  62.     {
  63.         return $this->content;
  64.     }
  65.     public function setContent(?string $content): self
  66.     {
  67.         $this->content $content;
  68.         return $this;
  69.     }
  70.     public function getPrice(): ?float
  71.     {
  72.         return $this->price;
  73.     }
  74.     public function setPrice(float $price): self
  75.     {
  76.         $this->price $price;
  77.         return $this;
  78.     }
  79.     public function getHandled(): bool
  80.     {
  81.         return $this->handled;
  82.     }
  83.     public function setHandled(bool $handled): self
  84.     {
  85.         $this->handled $handled;
  86.         return $this;
  87.     }
  88.     public function getLoaded(): bool
  89.     {
  90.         return $this->loaded;
  91.     }
  92.     public function setLoaded(bool $loaded): Report
  93.     {
  94.         $this->loaded $loaded;
  95.         return $this;
  96.     }
  97.     public function getOrder(): ?Order
  98.     {
  99.         return $this->order;
  100.     }
  101.     public function setOrder(?Order $order): Report
  102.     {
  103.         $this->order $order;
  104.         return $this;
  105.     }
  106.     public function getVin(): ?string
  107.     {
  108.         return $this->order?->getVin()?->getVin();
  109.     }
  110.     public function getCreatedAt(): ?\DateTimeInterface
  111.     {
  112.         return $this->order?->getCreatedAt();
  113.     }
  114. }