src/Entity/AnalysisServicePrice.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Entity;
  3. use App\Repository\AnalysisServicePriceRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Table]
  10. #[ORM\Entity(repositoryClass: AnalysisServicePriceRepository::class)]
  11. class AnalysisServicePrice
  12. {
  13. use TimestampableEntity;
  14. #[ORM\Id]
  15. #[ORM\GeneratedValue]
  16. #[ORM\Column(type: 'integer')]
  17. private int $id;
  18. #[ORM\ManyToOne(targetEntity: AnalysisService::class, inversedBy: 'prices')]
  19. private AnalysisService $service;
  20. #[ORM\ManyToOne(targetEntity: Company::class, inversedBy: 'prices')]
  21. private ?Company $company;
  22. #[ORM\Column(type: 'float', nullable: true)]
  23. private ?float $price = null;
  24. #[ORM\OneToMany(mappedBy: 'price', targetEntity: AnalysisServicePriceModifier::class, cascade: ['all'], orphanRemoval: true)]
  25. private iterable $modifier;
  26. #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
  27. private ?DateTimeImmutable $validFrom = null;
  28. #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
  29. private ?DateTimeImmutable $validTo = null;
  30. public function __construct()
  31. {
  32. $this->modifier = new ArrayCollection();
  33. $this->company = null;
  34. }
  35. public function getId(): int
  36. {
  37. return $this->id;
  38. }
  39. public function setId(int $id): AnalysisServicePrice
  40. {
  41. $this->id = $id;
  42. return $this;
  43. }
  44. public function getService(): AnalysisService
  45. {
  46. return $this->service;
  47. }
  48. public function setService(AnalysisService $service): AnalysisServicePrice
  49. {
  50. $this->service = $service;
  51. return $this;
  52. }
  53. public function getCompany(): ?Company
  54. {
  55. return $this->company;
  56. }
  57. public function setCompany(?Company $company): AnalysisServicePrice
  58. {
  59. $this->company = $company;
  60. return $this;
  61. }
  62. public function getPrice(): ?float
  63. {
  64. return $this->price;
  65. }
  66. public function setPrice(?float $price): AnalysisServicePrice
  67. {
  68. $this->price = $price;
  69. return $this;
  70. }
  71. public function getModifier(): iterable
  72. {
  73. return $this->modifier;
  74. }
  75. public function getValidFrom(): ?DateTimeImmutable
  76. {
  77. return $this->validFrom;
  78. }
  79. public function setValidFrom(?DateTimeImmutable $validFrom): AnalysisServicePrice
  80. {
  81. $this->validFrom = $validFrom;
  82. return $this;
  83. }
  84. public function getValidTo(): ?DateTimeImmutable
  85. {
  86. return $this->validTo;
  87. }
  88. public function setValidTo(?DateTimeImmutable $validTo): AnalysisServicePrice
  89. {
  90. $this->validTo = $validTo;
  91. return $this;
  92. }
  93. }