src/Entity/System/ServiceCustomer.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\System;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Table(name="ps_service_customer")
  9. *
  10. * @ORM\Entity(repositoryClass="App\Repository\System\ServiceCustomerRepository")
  11. */
  12. class ServiceCustomer
  13. {
  14. /**
  15. * @ORM\Id
  16. *
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. *
  19. * @ORM\Column(name="id_service_customer", type="integer")
  20. */
  21. private ?int $id;
  22. /**
  23. * @ORM\ManyToOne(targetEntity="App\Entity\System\Service", inversedBy="serviceCustomer")
  24. *
  25. * @ORM\JoinColumn(name="id_service", referencedColumnName="id_service", nullable=false)
  26. */
  27. private Service $service;
  28. /**
  29. * @ORM\ManyToOne(targetEntity="App\Entity\System\Customer", inversedBy="serviceCustomer")
  30. *
  31. * @ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer", nullable=false)
  32. */
  33. private Customer $customer;
  34. /**
  35. * @ORM\ManyToOne(targetEntity="App\Entity\System\Order")
  36. *
  37. * @ORM\JoinColumn(name="id_order", referencedColumnName="id_order")
  38. */
  39. private ?Order $order;
  40. /**
  41. * @ORM\ManyToOne(targetEntity="App\Entity\System\Product")
  42. *
  43. * @ORM\JoinColumn(name="id_product", referencedColumnName="id_product")
  44. */
  45. private ?Product $product;
  46. /**
  47. * @ORM\Column(type="boolean")
  48. */
  49. private bool $active;
  50. /**
  51. * @ORM\Column(type="datetime", nullable=true)
  52. */
  53. private ?\DateTime $dateAdd;
  54. /**
  55. * @ORM\ManyToOne(targetEntity="App\Entity\System\OrderDetail")
  56. *
  57. * @ORM\JoinColumn(name="id_order_detail", referencedColumnName="id_order_detail")
  58. */
  59. private ?OrderDetail $orderDetail;
  60. /**
  61. * @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
  62. */
  63. private bool $migrated = false;
  64. /**
  65. * @var Collection<int, ServiceCustomerParameter>
  66. *
  67. * @ORM\OneToMany(targetEntity="App\Entity\System\ServiceCustomerParameter", mappedBy="serviceCustomer", cascade={"persist"})
  68. */
  69. private Collection $serviceCustomerParameters;
  70. public function __construct()
  71. {
  72. $this->serviceCustomerParameters = new ArrayCollection();
  73. $this->dateAdd = new \DateTime();
  74. }
  75. public function getId(): ?int
  76. {
  77. return $this->id;
  78. }
  79. public function setId(int $id): ServiceCustomer
  80. {
  81. $this->id = $id;
  82. return $this;
  83. }
  84. public function getService(): Service
  85. {
  86. return $this->service;
  87. }
  88. public function setService(Service $service): ServiceCustomer
  89. {
  90. $this->service = $service;
  91. return $this;
  92. }
  93. public function getCustomer(): Customer
  94. {
  95. return $this->customer;
  96. }
  97. public function setCustomer(Customer $customer): ServiceCustomer
  98. {
  99. $this->customer = $customer;
  100. return $this;
  101. }
  102. public function setOrder(?Order $order): ServiceCustomer
  103. {
  104. $this->order = $order;
  105. return $this;
  106. }
  107. public function getOrder(): ?Order
  108. {
  109. return $this->order;
  110. }
  111. public function getProduct(): ?Product
  112. {
  113. return $this->product;
  114. }
  115. public function setProduct(?Product $product): ServiceCustomer
  116. {
  117. $this->product = $product;
  118. return $this;
  119. }
  120. public function getActive(): bool
  121. {
  122. return $this->active;
  123. }
  124. public function setActive(bool $active): ServiceCustomer
  125. {
  126. $this->active = $active;
  127. return $this;
  128. }
  129. public function getDateAdd(): ?\DateTime
  130. {
  131. return $this->dateAdd;
  132. }
  133. public function setDateAdd(?\DateTime $dateAdd): ServiceCustomer
  134. {
  135. $this->dateAdd = $dateAdd;
  136. return $this;
  137. }
  138. /**
  139. * @return Collection<int, ServiceCustomerParameter>
  140. */
  141. public function getServiceCustomerParameters(): Collection
  142. {
  143. return $this->serviceCustomerParameters;
  144. }
  145. /**
  146. * @param Collection<int, ServiceCustomerParameter> $serviceCustomerParameters
  147. */
  148. public function setServiceCustomerParameters(Collection $serviceCustomerParameters): ServiceCustomer
  149. {
  150. $this->serviceCustomerParameters = $serviceCustomerParameters;
  151. return $this;
  152. }
  153. public function getOrderDetail(): ?OrderDetail
  154. {
  155. return $this->orderDetail;
  156. }
  157. public function setOrderDetail(?OrderDetail $orderDetail): ServiceCustomer
  158. {
  159. $this->orderDetail = $orderDetail;
  160. return $this;
  161. }
  162. public function isMigrated(): bool
  163. {
  164. return $this->migrated;
  165. }
  166. public function setMigrated(bool $migrated): ServiceCustomer
  167. {
  168. $this->migrated = $migrated;
  169. return $this;
  170. }
  171. public function initializeCustomerAndService(Customer $customer, Service $service): void
  172. {
  173. $this->customer = $customer;
  174. $this->service = $service;
  175. $this->active = true;
  176. $this->dateAdd = new \DateTime();
  177. }
  178. }