src/Entity/DeliveryMan.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Variables\Equipment;
  4. use App\Repository\DeliveryManRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity(repositoryClass=DeliveryManRepository::class)
  10. */
  11. class DeliveryMan extends User
  12. {
  13. protected string $discr = 'deliveryMan';
  14. /**
  15. * @ORM\ManyToMany(targetEntity=Delivery::class, mappedBy="deliveryMen", orphanRemoval=true, cascade={"persist"})
  16. *
  17. * @var Collection<int, Delivery>
  18. */
  19. private Collection $deliveries;
  20. /**
  21. * @ORM\OneToMany(targetEntity=Sector::class, mappedBy="deliveryMan", orphanRemoval=true, cascade={"persist"})
  22. *
  23. * @var Collection<int, Sector>
  24. */
  25. private Collection $sectors;
  26. /**
  27. * @ORM\OneToMany(targetEntity=Document::class, mappedBy="deliveryMan", orphanRemoval=true, cascade={"persist"})
  28. *
  29. * @var Collection<int, Document>
  30. */
  31. private Collection $documents;
  32. /**
  33. * @ORM\ManyToOne(targetEntity=Vehicle::class)
  34. */
  35. private Vehicle $vehicle;
  36. /**
  37. * @ORM\Column(type="boolean")
  38. */
  39. protected bool $isHeavy = false;
  40. /**
  41. * @ORM\ManyToOne(targetEntity=VehicleType::class)
  42. */
  43. private ?VehicleType $vehicleType = null;
  44. /**
  45. * @ORM\OneToMany(targetEntity=Course::class, mappedBy="deliveryMan")
  46. *
  47. * @var Collection<int, Course>
  48. */
  49. private Collection $courses;
  50. /**
  51. * @ORM\OneToOne(targetEntity=Tracking::class, cascade={"persist", "remove"})
  52. */
  53. private ?Tracking $lastPosition;
  54. /**
  55. * @ORM\OneToMany(targetEntity=CourseProposal::class, mappedBy="deliveryMan")
  56. *
  57. * @var Collection<int, CourseProposal>
  58. */
  59. private Collection $courseProposals;
  60. /**
  61. * @ORM\OneToMany(targetEntity=DeliveryManStatement::class, mappedBy="deliveryMan", orphanRemoval=true)
  62. *
  63. * @var Collection<int, DeliveryManStatement>
  64. */
  65. private Collection $deliveryManStatements;
  66. /**
  67. * @ORM\ManyToMany(targetEntity=Equipment::class, inversedBy="deliveryMen")
  68. *
  69. * @var Collection<int, Equipment>
  70. */
  71. private Collection $equipments;
  72. /**
  73. * @ORM\OneToMany(targetEntity=DeliveryManContract::class, mappedBy="deliveryMan", orphanRemoval=true)
  74. *
  75. * @var Collection<int, DeliveryManContract>
  76. */
  77. private Collection $deliveryManContracts;
  78. /**
  79. * @ORM\Column(type="text", nullable=true)
  80. */
  81. private ?string $signature;
  82. /**
  83. * @ORM\Column(type="string", length=50, nullable=true)
  84. */
  85. private ?string $barCode;
  86. /**
  87. * @ORM\Column(type="text", nullable=true)
  88. */
  89. private ?string $controlString;
  90. /**
  91. * @ORM\Column(type="text", nullable=true)
  92. */
  93. private ?string $socialReason;
  94. /**
  95. * @ORM\Column(type="text", nullable=true)
  96. */
  97. private ?string $siret;
  98. /**
  99. * @ORM\Column(type="text", nullable=true)
  100. */
  101. private ?string $siren;
  102. // /**
  103. // * @ORM\Column(type="float", nullable=true)
  104. // */
  105. // private $accountBalance;
  106. public function __construct()
  107. {
  108. parent::__construct();
  109. $this->deliveries = new ArrayCollection();
  110. $this->sectors = new ArrayCollection();
  111. $this->documents = new ArrayCollection();
  112. $this->courses = new ArrayCollection();
  113. $this->courseProposals = new ArrayCollection();
  114. $this->deliveryManStatements = new ArrayCollection();
  115. $this->equipments = new ArrayCollection();
  116. $this->deliveryManContracts = new ArrayCollection();
  117. }
  118. /**
  119. * @return Collection<int, Delivery>
  120. */
  121. public function getDeliveries(): Collection
  122. {
  123. return $this->deliveries;
  124. }
  125. public function addDelivery(Delivery $delivery): self
  126. {
  127. if (!$this->deliveries->contains($delivery)) {
  128. $this->deliveries[] = $delivery;
  129. $delivery->addDeliveryMan($this);
  130. }
  131. return $this;
  132. }
  133. public function removeDelivery(Delivery $delivery): self
  134. {
  135. if ($this->deliveries->removeElement($delivery)) {
  136. $delivery->removeDeliveryMan($this);
  137. }
  138. return $this;
  139. }
  140. /**
  141. * @return Collection<int, Sector>
  142. */
  143. public function getSectors(): Collection
  144. {
  145. return $this->sectors;
  146. }
  147. public function addSector(Sector $sector): self
  148. {
  149. if (!$this->sectors->contains($sector)) {
  150. $this->sectors[] = $sector;
  151. $sector->setDeliveryMan($this);
  152. }
  153. return $this;
  154. }
  155. public function removeSector(Sector $sector): self
  156. {
  157. $this->sectors->removeElement($sector);
  158. return $this;
  159. }
  160. /**
  161. * @return Collection<int, Document>
  162. */
  163. public function getDocuments(): Collection
  164. {
  165. return $this->documents;
  166. }
  167. public function addDocument(Document $document): self
  168. {
  169. if (!$this->documents->contains($document)) {
  170. $this->documents[] = $document;
  171. $document->setDeliveryMan($this);
  172. }
  173. return $this;
  174. }
  175. public function removeDocument(Document $document): self
  176. {
  177. if ($this->documents->removeElement($document)) {
  178. // set the owning side to null (unless already changed)
  179. if ($document->getDeliveryMan() === $this) {
  180. $document->setDeliveryMan(null);
  181. }
  182. }
  183. return $this;
  184. }
  185. public function removeAllDocuments(): self
  186. {
  187. foreach ($this->documents as $document) {
  188. $this->removeDocument($document);
  189. }
  190. return $this;
  191. }
  192. public function getVehicle(): ?Vehicle
  193. {
  194. return $this->vehicle;
  195. }
  196. public function getDiscr(): ?string
  197. {
  198. return $this->discr;
  199. }
  200. public function setVehicle(Vehicle $vehicle): self
  201. {
  202. $this->vehicle = $vehicle;
  203. return $this;
  204. }
  205. /**
  206. * Get the value of plainPassword.
  207. */
  208. public function getPlainPassword(): ?string
  209. {
  210. return $this->plainPassword;
  211. }
  212. /**
  213. * Set the value of plainPassword.
  214. *
  215. * @return self
  216. */
  217. public function setPlainPassword(?string $plainPassword)
  218. {
  219. $this->plainPassword = $plainPassword;
  220. return $this;
  221. }
  222. /**
  223. * Get the value of isHeavy.
  224. */
  225. public function isHeavy(): bool
  226. {
  227. return $this->isHeavy;
  228. }
  229. /**
  230. * Set the value of isHeavy.
  231. *
  232. * @return self
  233. */
  234. public function setIsHeavy(bool $isHeavy)
  235. {
  236. $this->isHeavy = $isHeavy;
  237. return $this;
  238. }
  239. /**
  240. * Get the value of vehicleType.
  241. */
  242. public function getVehicleType(): ?VehicleType
  243. {
  244. return $this->vehicleType;
  245. }
  246. /**
  247. * Set the value of vehicleType.
  248. *
  249. * @return self
  250. */
  251. public function setVehicleType(?VehicleType $vehicleType)
  252. {
  253. $this->vehicleType = $vehicleType;
  254. return $this;
  255. }
  256. /**
  257. * @return Collection<int, Course>
  258. */
  259. public function getCourses(): Collection
  260. {
  261. return $this->courses;
  262. }
  263. public function addCourse(Course $course): self
  264. {
  265. if (!$this->courses->contains($course)) {
  266. $this->courses[] = $course;
  267. $course->setDeliveryMan($this);
  268. }
  269. return $this;
  270. }
  271. public function removeCourse(Course $course): self
  272. {
  273. $this->courses->removeElement($course);
  274. return $this;
  275. }
  276. public function getLastPosition(): ?Tracking
  277. {
  278. return $this->lastPosition;
  279. }
  280. public function setLastPosition(?Tracking $lastPosition): self
  281. {
  282. $this->lastPosition = $lastPosition;
  283. return $this;
  284. }
  285. /**
  286. * @return Collection<int, CourseProposal>
  287. */
  288. public function getCourseProposals(): Collection
  289. {
  290. return $this->courseProposals;
  291. }
  292. public function addCourseProposal(CourseProposal $courseProposal): self
  293. {
  294. if (!$this->courseProposals->contains($courseProposal)) {
  295. $this->courseProposals[] = $courseProposal;
  296. $courseProposal->setDeliveryMan($this);
  297. }
  298. return $this;
  299. }
  300. /**
  301. * @return Collection<int, DeliveryManStatement>
  302. */
  303. public function getDeliveryManStatements(): Collection
  304. {
  305. return $this->deliveryManStatements;
  306. }
  307. public function addDeliveryManStatement(DeliveryManStatement $deliveryManStatement): self
  308. {
  309. if (!$this->deliveryManStatements->contains($deliveryManStatement)) {
  310. $this->deliveryManStatements[] = $deliveryManStatement;
  311. $deliveryManStatement->setDeliveryMan($this);
  312. }
  313. return $this;
  314. }
  315. public function removeCourseProposal(CourseProposal $courseProposal): self
  316. {
  317. $this->courseProposals->removeElement($courseProposal);
  318. return $this;
  319. }
  320. public function removeDeliveryManStatement(DeliveryManStatement $deliveryManStatement): self
  321. {
  322. $this->deliveryManStatements->removeElement($deliveryManStatement);
  323. return $this;
  324. }
  325. /**
  326. * @return Collection<int, Equipment>
  327. */
  328. public function getEquipments(): Collection
  329. {
  330. return $this->equipments;
  331. }
  332. public function addEquipment(Equipment $equipment): self
  333. {
  334. if (!$this->equipments->contains($equipment)) {
  335. $this->equipments[] = $equipment;
  336. }
  337. return $this;
  338. }
  339. public function removeEquipment(Equipment $equipment): self
  340. {
  341. $this->equipments->removeElement($equipment);
  342. return $this;
  343. }
  344. /**
  345. * @return Collection<int, DeliveryManContract>
  346. */
  347. public function getDeliveryManContracts(): Collection
  348. {
  349. return $this->deliveryManContracts;
  350. }
  351. public function addDeliveryManContract(DeliveryManContract $deliveryManContract): self
  352. {
  353. if (!$this->deliveryManContracts->contains($deliveryManContract)) {
  354. $this->deliveryManContracts[] = $deliveryManContract;
  355. $deliveryManContract->setDeliveryMan($this);
  356. }
  357. return $this;
  358. }
  359. public function removeDeliveryManContract(DeliveryManContract $deliveryManContract): self
  360. {
  361. $this->deliveryManContracts->removeElement($deliveryManContract);
  362. return $this;
  363. }
  364. public function getSignature(): ?string
  365. {
  366. return $this->signature;
  367. }
  368. public function setSignature(?string $signature): self
  369. {
  370. $this->signature = $signature;
  371. return $this;
  372. }
  373. public function getBarCode(): ?string
  374. {
  375. return $this->barCode;
  376. }
  377. public function setBarCode(?string $barCode): self
  378. {
  379. $this->barCode = $barCode;
  380. return $this;
  381. }
  382. public function getControlString(): ?string
  383. {
  384. return $this->controlString;
  385. }
  386. public function setControlString(?string $controlString): self
  387. {
  388. $this->controlString = $controlString;
  389. return $this;
  390. }
  391. public function getSocialReason(): ?string
  392. {
  393. return $this->socialReason;
  394. }
  395. public function setSocialReason(?string $socialReason): self
  396. {
  397. $this->socialReason = $socialReason;
  398. return $this;
  399. }
  400. public function getsiret(): ?string
  401. {
  402. return $this->siret;
  403. }
  404. public function setSiret(?string $siret): self
  405. {
  406. $this->siret = $siret;
  407. return $this;
  408. }
  409. public function getSiren(): ?string
  410. {
  411. return $this->siren;
  412. }
  413. public function setSiren(?string $siren): self
  414. {
  415. $this->siren = $siren;
  416. return $this;
  417. }
  418. }