src/Entity/Customer.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CustomerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=CustomerRepository::class)
  9. */
  10. class Customer
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private ?int $id;
  18. /**
  19. * @ORM\Column(type="string", length=255)
  20. */
  21. private ?string $name = null;
  22. /**
  23. * @ORM\Column(type="string", length=255, nullable=true)
  24. */
  25. private ?string $phone = null;
  26. /**
  27. * @ORM\Column(type="string", length=255, nullable=true)
  28. */
  29. private ?string $principalContact = null;
  30. /**
  31. * @ORM\Column(type="integer")
  32. */
  33. private ?int $priority = null;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private ?string $town = null;
  38. /**
  39. * @ORM\Column(type="string", length=255, nullable=true)
  40. */
  41. private ?string $postalCode = null;
  42. /**
  43. * @ORM\Column(type="string", length=255, nullable=true)
  44. */
  45. private ?string $address = null;
  46. /**
  47. * @ORM\Column(type="string", length=255, nullable=true)
  48. */
  49. private ?string $address2 = null;
  50. /**
  51. * @ORM\Column(type="string", length=255, nullable=true)
  52. */
  53. private ?string $activitySector = null;
  54. /**
  55. * @ORM\Column(type="text", nullable=true)
  56. */
  57. private ?string $picture = null;
  58. /**
  59. * @ORM\Column(type="boolean")
  60. */
  61. private ?bool $enable = null;
  62. /**
  63. * @ORM\ManyToOne(targetEntity=Contact::class)
  64. * @ORM\JoinColumn(nullable=true)
  65. */
  66. private ?Contact $contactPrincipal;
  67. /**
  68. * @ORM\Column(type="string", length=255, nullable=true)
  69. */
  70. private ?string $siret;
  71. /**
  72. * @ORM\Column(type="datetime")
  73. */
  74. private \DateTime $createdAt;
  75. /**
  76. * @ORM\OneToMany(targetEntity=Ticket::class, mappedBy="customer")
  77. */
  78. private Collection $tickets;
  79. /**
  80. * @ORM\Column(type="string", length=255, nullable=true)
  81. */
  82. private ?string $numberPoste = null;
  83. /**
  84. * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="customer")
  85. */
  86. private $contacts;
  87. public function __construct()
  88. {
  89. $this->setPriority(0); // default value
  90. $this->setEnable(1); // default value
  91. $this->createdAt = new \DateTime(" 00:00:00");
  92. $this->tickets = new ArrayCollection();
  93. $this->contacts = new ArrayCollection();
  94. }
  95. public function getId(): ?int
  96. {
  97. return $this->id;
  98. }
  99. public function getName(): ?string
  100. {
  101. return $this->name;
  102. }
  103. public function setName(string $name): self
  104. {
  105. $this->name = $name;
  106. return $this;
  107. }
  108. public function getPhone(): ?string
  109. {
  110. return $this->phone;
  111. }
  112. public function setPhone(?string $phone): self
  113. {
  114. $this->phone = $phone;
  115. return $this;
  116. }
  117. public function getPrincipalContact(): ?string
  118. {
  119. return $this->principalContact;
  120. }
  121. public function setPrincipalContact(?string $principalContact): self
  122. {
  123. $this->principalContact = $principalContact;
  124. return $this;
  125. }
  126. public function getPriority(): ?int
  127. {
  128. return $this->priority;
  129. }
  130. public function setPriority(int $priority): self
  131. {
  132. $this->priority = $priority;
  133. return $this;
  134. }
  135. public function getTown(): ?string
  136. {
  137. return $this->town;
  138. }
  139. public function setTown(?string $town): self
  140. {
  141. $this->town = $town;
  142. return $this;
  143. }
  144. public function getPostalCode(): ?string
  145. {
  146. return $this->postalCode;
  147. }
  148. public function setPostalCode(?string $postalCode): self
  149. {
  150. $this->postalCode = $postalCode;
  151. return $this;
  152. }
  153. public function getAddress(): ?string
  154. {
  155. return $this->address;
  156. }
  157. public function setAddress(?string $address): self
  158. {
  159. $this->address = $address;
  160. return $this;
  161. }
  162. public function getAddress2(): ?string
  163. {
  164. return $this->address2;
  165. }
  166. public function setAddress2(?string $address2): self
  167. {
  168. $this->address2 = $address2;
  169. return $this;
  170. }
  171. public function getActivitySector(): ?string
  172. {
  173. return $this->activitySector;
  174. }
  175. public function setActivitySector(?string $activitySector): self
  176. {
  177. $this->activitySector = $activitySector;
  178. return $this;
  179. }
  180. public function getPicture(): ?string
  181. {
  182. return $this->picture;
  183. }
  184. public function setPicture(?string $picture): self
  185. {
  186. $this->picture = $picture;
  187. return $this;
  188. }
  189. public function getEnable(): ?bool
  190. {
  191. return $this->enable;
  192. }
  193. public function setEnable(bool $enable): self
  194. {
  195. $this->enable = $enable;
  196. return $this;
  197. }
  198. public function getSiret(): ?string
  199. {
  200. return $this->siret;
  201. }
  202. public function setSiret(?string $siret): self
  203. {
  204. $this->siret = $siret;
  205. return $this;
  206. }
  207. public function getCreatedAt(): ?\DateTimeInterface
  208. {
  209. return $this->createdAt;
  210. }
  211. public function setCreatedAt(\DateTimeInterface $createdAt): self
  212. {
  213. $this->createdAt = $createdAt;
  214. return $this;
  215. }
  216. public function getNumberPoste(): ?string
  217. {
  218. return $this->numberPoste;
  219. }
  220. public function setNumberPoste(?string $numberPoste): self
  221. {
  222. $this->numberPoste = $numberPoste;
  223. return $this;
  224. }
  225. public function getContactPrincipal(): ?Contact
  226. {
  227. return $this->contactPrincipal;
  228. }
  229. public function setContactPrincipal(?Contact $contactPrincipal): self
  230. {
  231. $this->contactPrincipal = $contactPrincipal;
  232. return $this;
  233. }
  234. /**
  235. * @return Collection|Ticket[]
  236. */
  237. public function getTickets(): Collection
  238. {
  239. return $this->tickets;
  240. }
  241. public function addTicket(Ticket $ticket): self
  242. {
  243. if (!$this->tickets->contains($ticket)) {
  244. $this->tickets[] = $ticket;
  245. $ticket->setCustomer($this);
  246. }
  247. return $this;
  248. }
  249. public function removeTicket(Ticket $ticket): self
  250. {
  251. if ($this->tickets->removeElement($ticket)) {
  252. // set the owning side to null (unless already changed)
  253. if ($ticket->getCustomer() === $this) {
  254. $ticket->setCustomer(null);
  255. }
  256. }
  257. return $this;
  258. }
  259. /**
  260. * @return Collection|Contact[]
  261. */
  262. public function getContacts(): Collection
  263. {
  264. return $this->contacts;
  265. }
  266. public function addContact(Contact $contact): self
  267. {
  268. if (!$this->contacts->contains($contact)) {
  269. $this->contacts[] = $contact;
  270. $contact->setCustomers($this);
  271. }
  272. return $this;
  273. }
  274. public function removeContact(Contact $contact): self
  275. {
  276. if ($this->contacts->removeElement($contact)) {
  277. // set the owning side to null (unless already changed)
  278. if ($contact->getCustomers() === $this) {
  279. $contact->setCustomers(null);
  280. }
  281. }
  282. return $this;
  283. }
  284. }