src/Entity/VendorQuotation.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VendorQuotationRepository;
  4. use Symfony\Component\Serializer\Annotation\Groups;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassVendorQuotationRepository::class)]
  7. class VendorQuotation
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[Groups(['LogService'])]
  14.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'vendorQuotations')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private $createdBy;
  17.     #[ORM\Column(type'datetime')]
  18.     private $createdAt;
  19.     #[Groups(['LogService'])]
  20.     #[ORM\Column(type'string'length255nullabletrue)]
  21.     private $filepath;
  22.     #[Groups(['LogService'])]
  23.     #[ORM\Column(type'string'length255nullabletrue)]
  24.     private $filename;
  25.     #[Groups(['LogService'])]
  26.     #[ORM\ManyToOne(targetEntityVendorQuotationPlanning::class, inversedBy'vendorQuotations')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private $vendorQuotationPlanning;
  29.     #[ORM\Column(type'datetime'nullabletrue)]
  30.     private $updatedAt;
  31.     #[ORM\ManyToOne(targetEntityUser::class)]
  32.     private $updatedBy;
  33.     #[ORM\Column(type'string'length64nullabletrue)]
  34.     private $filetype;
  35.     #[ORM\Column(type'float')]
  36.     private $amount;
  37.     #[ORM\ManyToOne(targetEntityCurrency::class, inversedBy'vendorQuotations')]
  38.     #[ORM\JoinColumn(nullablefalse)]
  39.     private $currency;
  40.     public  function __construct(){
  41.         $this->createdAt = new \DateTime();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getCreatedBy(): ?User
  48.     {
  49.         return $this->createdBy;
  50.     }
  51.     public function setCreatedBy(?User $createdBy): self
  52.     {
  53.         $this->createdBy $createdBy;
  54.         return $this;
  55.     }
  56.     public function getCreatedAt(): ?\DateTimeInterface
  57.     {
  58.         return $this->createdAt;
  59.     }
  60.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  61.     {
  62.         $this->createdAt $createdAt;
  63.         return $this;
  64.     }
  65.     public function getFilepath(): ?string
  66.     {
  67.         return $this->filepath;
  68.     }
  69.     public function setFilepath(string $filepath): self
  70.     {
  71.         $this->filepath $filepath;
  72.         return $this;
  73.     }
  74.     public function getFilename(): ?string
  75.     {
  76.         return $this->filename;
  77.     }
  78.     public function setFilename(string $filename): self
  79.     {
  80.         $this->filename $filename;
  81.         return $this;
  82.     }
  83.     public function getVendorQuotationPlanning(): ?VendorQuotationPlanning
  84.     {
  85.         return $this->vendorQuotationPlanning;
  86.     }
  87.     public function setVendorQuotationPlanning(?VendorQuotationPlanning $vendorQuotationPlanning): self
  88.     {
  89.         $this->vendorQuotationPlanning $vendorQuotationPlanning;
  90.         return $this;
  91.     }
  92.     public function getUpdatedAt(): ?\DateTimeInterface
  93.     {
  94.         return $this->updatedAt;
  95.     }
  96.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  97.     {
  98.         $this->updatedAt $updatedAt;
  99.         return $this;
  100.     }
  101.     public function getUpdatedBy(): ?User
  102.     {
  103.         return $this->updatedBy;
  104.     }
  105.     public function setUpdatedBy(?User $updatedBy): self
  106.     {
  107.         $this->updatedBy $updatedBy;
  108.         return $this;
  109.     }
  110.     public function getFiletype(): ?string
  111.     {
  112.         return $this->filetype;
  113.     }
  114.     public function setFiletype(?string $filetype): self
  115.     {
  116.         $this->filetype $filetype;
  117.         return $this;
  118.     }
  119.     public function getAmount(): ?float
  120.     {
  121.         return $this->amount;
  122.     }
  123.     public function setAmount(float $amount): self
  124.     {
  125.         $this->amount $amount;
  126.         return $this;
  127.     }
  128.     public function getAmountUsd(): ?float
  129.     {
  130.         global $kernel;
  131.         $currencyService $kernel->getContainer()->get('CurrencyService');
  132.         $dateStr $this->createdAt->format('Y-m-d');
  133.         return $currencyService->convertAtDate($dateStr$this->currency->getIso(), 'USD'$this->amount);
  134.     }
  135.     public function getCurrency(): ?Currency
  136.     {
  137.         return $this->currency;
  138.     }
  139.     public function setCurrency(?Currency $currency): self
  140.     {
  141.         $this->currency $currency;
  142.         return $this;
  143.     }
  144. }