src/Entity/System/ServiceCustomer.php line 13

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