src/Entity/Rate.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RateRepository;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassRateRepository::class)]
  10. class Rate
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     #[Groups(['order:list'])]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     #[Groups(['order:list'])]
  19.     private ?string $reference null;
  20.     #[ORM\Column]
  21.     #[Groups(['order:list'])]
  22.     private ?float $value null;
  23.     #[ORM\ManyToOne]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Currency $currency null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  27.     private ?DateTimeInterface $createdAt null;
  28.     #[ORM\ManyToOne(inversedBy'rates')]
  29.     #[ORM\JoinColumn(nullablefalse)]
  30.     private ?Establishment $establishment null;
  31.     public function __construct()
  32.     {
  33.         if (is_null($this->createdAt)) $this->createdAt = new DateTime();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getReference(): ?string
  40.     {
  41.         return $this->reference;
  42.     }
  43.     public function setReference(string $reference): self
  44.     {
  45.         $this->reference $reference;
  46.         return $this;
  47.     }
  48.     public function getValue(): ?float
  49.     {
  50.         return $this->value;
  51.     }
  52.     public function setValue(float $value): self
  53.     {
  54.         $this->value $value;
  55.         return $this;
  56.     }
  57.     public function getCurrency(): ?Currency
  58.     {
  59.         return $this->currency;
  60.     }
  61.     public function setCurrency(?Currency $currency): self
  62.     {
  63.         $this->currency $currency;
  64.         return $this;
  65.     }
  66.     public function getCreatedAt(): ?DateTimeInterface
  67.     {
  68.         return $this->createdAt;
  69.     }
  70.     public function setCreatedAt(DateTimeInterface $createdAt): self
  71.     {
  72.         $this->createdAt $createdAt;
  73.         return $this;
  74.     }
  75.     public function getEstablishment(): ?Establishment
  76.     {
  77.         return $this->establishment;
  78.     }
  79.     public function setEstablishment(?Establishment $establishment): self
  80.     {
  81.         $this->establishment $establishment;
  82.         return $this;
  83.     }
  84.     public function __toString(): string
  85.     {
  86.         return  $this->getValue();
  87.     }
  88. }