src/Entity/Manager.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\Collection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * Manager
  7. *
  8. * @ORM\Table(name="manager", uniqueConstraints={@ORM\UniqueConstraint(name="manager_id_uindex", columns={"id"})})
  9. * @ORM\Entity(repositoryClass="App\Repository\ManagerRepository")
  10. */
  11. class Manager
  12. {
  13. /**
  14. * @var int
  15. *
  16. * @ORM\Column(name="id", type="integer", nullable=false)
  17. * @ORM\Id
  18. * @ORM\GeneratedValue(strategy="IDENTITY")
  19. */
  20. private $id;
  21. /**
  22. * @var string|null
  23. *
  24. * @ORM\Column(name="first_name", type="string", length=255, nullable=true)
  25. */
  26. private $firstName;
  27. /**
  28. * @var string|null
  29. *
  30. * @ORM\Column(name="last_name", type="string", length=255, nullable=true)
  31. */
  32. private $lastName;
  33. /**
  34. * @var bool|null
  35. *
  36. * @ORM\Column(name="admin", type="boolean", nullable=true)
  37. */
  38. private $admin = false;
  39. /**
  40. * @var bool|null
  41. *
  42. * @ORM\Column(name="allow_particuliers", type="boolean", nullable=true)
  43. */
  44. private $allowParticuliers = false;
  45. /**
  46. * @var bool|null
  47. *
  48. * @ORM\Column(name="allow_offres_sur_grilles", type="boolean", nullable=true)
  49. */
  50. private $allowOffresSurGrilles = false;
  51. /**
  52. * @var bool|null
  53. *
  54. * @ORM\Column(name="allow_cotations", type="boolean", nullable=true)
  55. */
  56. private $allowCotations = false;
  57. /**
  58. * @var bool|null
  59. *
  60. * @ORM\Column(name="allow_customer_base", type="boolean", nullable=true)
  61. */
  62. private $allowCustomerBase = false;
  63. /**
  64. * @var string|null
  65. *
  66. * @ORM\Column(name="email", type="string", length=255, nullable=true)
  67. */
  68. private $email;
  69. /**
  70. * @var string|null
  71. *
  72. * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  73. */
  74. private $phone;
  75. /**
  76. * @var Account|null
  77. *
  78. * @ORM\OneToOne(targetEntity="Account", mappedBy="manager")
  79. */
  80. private $account;
  81. /**
  82. * @var Collection
  83. *
  84. * @ORM\ManyToMany(targetEntity="Manager", inversedBy="teamMembers")
  85. * @ORM\JoinTable(name="manager_has_supervisor",
  86. * joinColumns={
  87. * @ORM\JoinColumn(name="manager_id", referencedColumnName="id")
  88. * },
  89. * inverseJoinColumns={
  90. * @ORM\JoinColumn(name="supervisor_id", referencedColumnName="id")
  91. * }
  92. * )
  93. */
  94. private $supervisors = array();
  95. /**
  96. * @var Collection
  97. *
  98. * @ORM\ManyToMany(targetEntity="Manager", mappedBy="supervisors")
  99. */
  100. private $teamMembers = array();
  101. /**
  102. * @var string|null
  103. *
  104. * @ORM\Column(name="referent_pricing", type="string", length=255, nullable=true)
  105. */
  106. private $referentPricing = "pricing@flash-consulting.fr";
  107. /**
  108. * Constructor
  109. */
  110. public function __construct()
  111. {
  112. $this->supervisors = new \Doctrine\Common\Collections\ArrayCollection();
  113. $this->teamMembers = new \Doctrine\Common\Collections\ArrayCollection();
  114. }
  115. /**
  116. * @return int
  117. */
  118. public function getId()
  119. {
  120. return $this->id;
  121. }
  122. /**
  123. * @param int $id
  124. */
  125. public function setId($id)
  126. {
  127. $this->id = $id;
  128. }
  129. /**
  130. * @return string|null
  131. */
  132. public function getFirstName()
  133. {
  134. return $this->firstName;
  135. }
  136. /**
  137. * @param string|null $firstName
  138. */
  139. public function setFirstName($firstName)
  140. {
  141. $this->firstName = $firstName;
  142. }
  143. /**
  144. * @return string|null
  145. */
  146. public function getLastName()
  147. {
  148. return $this->lastName;
  149. }
  150. /**
  151. * @param string|null $lastName
  152. */
  153. public function setLastName($lastName)
  154. {
  155. $this->lastName = $lastName;
  156. }
  157. /**
  158. * @return bool|null
  159. */
  160. public function getAdmin()
  161. {
  162. return $this->admin;
  163. }
  164. /**
  165. * @param bool|null $admin
  166. */
  167. public function setAdmin($admin)
  168. {
  169. $this->admin = $admin;
  170. }
  171. public function getAllowParticuliers(): ?bool
  172. {
  173. return $this->allowParticuliers;
  174. }
  175. public function setAllowParticuliers(?bool $allowParticuliers): void
  176. {
  177. $this->allowParticuliers = $allowParticuliers;
  178. }
  179. public function getAllowOffresSurGrilles(): ?bool
  180. {
  181. return $this->allowOffresSurGrilles;
  182. }
  183. public function setAllowOffresSurGrilles(?bool $allowOffresSurGrilles): void
  184. {
  185. $this->allowOffresSurGrilles = $allowOffresSurGrilles;
  186. }
  187. public function getAllowCotations(): ?bool
  188. {
  189. return $this->allowCotations;
  190. }
  191. public function setAllowCotations(?bool $allowCotations): void
  192. {
  193. $this->allowCotations = $allowCotations;
  194. }
  195. public function getAllowCustomerBase(): ?bool
  196. {
  197. return $this->allowCustomerBase;
  198. }
  199. public function setAllowCustomerBase(?bool $allowCustomerBase): void
  200. {
  201. $this->allowCustomerBase = $allowCustomerBase;
  202. }
  203. /**
  204. * @return string|null
  205. */
  206. public function getEmail(): ?string
  207. {
  208. return $this->email;
  209. }
  210. /**
  211. * @param string|null $email
  212. */
  213. public function setEmail(?string $email): void
  214. {
  215. $this->email = $email;
  216. }
  217. /**
  218. * @return string|null
  219. */
  220. public function getPhone(): ?string
  221. {
  222. return $this->phone;
  223. }
  224. /**
  225. * @param string|null $phone
  226. */
  227. public function setPhone(?string $phone): void
  228. {
  229. $this->phone = $phone;
  230. }
  231. /**
  232. * @return Account|null
  233. */
  234. public function getAccount(): ?Account
  235. {
  236. return $this->account;
  237. }
  238. /**
  239. * @param Account|null $account
  240. */
  241. public function setAccount(?Account $account): void
  242. {
  243. $this->account = $account;
  244. }
  245. public function getSupervisors(): \Doctrine\Common\Collections\ArrayCollection|Collection
  246. {
  247. return $this->supervisors;
  248. }
  249. public function setSupervisors(\Doctrine\Common\Collections\ArrayCollection|Collection $supervisors): void
  250. {
  251. $this->supervisors = $supervisors;
  252. }
  253. public function getTeamMembers(): \Doctrine\Common\Collections\ArrayCollection|Collection
  254. {
  255. return $this->teamMembers;
  256. }
  257. public function setTeamMembers(\Doctrine\Common\Collections\ArrayCollection|Collection $teamMembers): void
  258. {
  259. $this->teamMembers = $teamMembers;
  260. }
  261. public function addSupervisor(Manager $supervisor): self
  262. {
  263. if (!$this->supervisors->contains($supervisor)) {
  264. $this->supervisors->add($supervisor);
  265. $supervisor->addTeamMember($this);
  266. }
  267. return $this;
  268. }
  269. public function removeSupervisor(Manager $supervisor): self
  270. {
  271. if ($this->supervisors->contains($supervisor)) {
  272. $this->supervisors->removeElement($supervisor);
  273. $supervisor->removeTeamMember($this);
  274. }
  275. return $this;
  276. }
  277. public function addTeamMember(Manager $teamMember): self
  278. {
  279. if (!$this->teamMembers->contains($teamMember)) {
  280. $this->teamMembers->add($teamMember);
  281. $teamMember->addSupervisor($this);
  282. }
  283. return $this;
  284. }
  285. public function removeTeamMember(Manager $teamMember): self
  286. {
  287. if ($this->teamMembers->contains($teamMember)) {
  288. $this->teamMembers->removeElement($teamMember);
  289. $teamMember->removeSupervisor($this);
  290. }
  291. return $this;
  292. }
  293. public function getFullName(): string
  294. {
  295. return $this->getFirstName().' '.$this->getLastName();
  296. }
  297. public function hasTeamMember(): bool
  298. {
  299. if ($this->getTeamMembers()->count() > 0) {
  300. return true;
  301. }
  302. return false;
  303. }
  304. public function isSupervisedBy(Manager $manager): bool
  305. {
  306. if ($this->getSupervisors()->contains($manager)) {
  307. return true;
  308. }
  309. return false;
  310. }
  311. public function getReferentPricing(): ?string
  312. {
  313. return $this->referentPricing;
  314. }
  315. public function setReferentPricing(?string $referentPricing): void
  316. {
  317. $this->referentPricing = $referentPricing;
  318. }
  319. }