Person.php 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391
  1. <?php
  2. namespace AppBundle\Entity\Person;
  3. use AppBundle\Annotation\ExportSplitFields;
  4. use AppBundle\Entity\AccessAndFunction\Access;
  5. use AppBundle\Entity\AccessWish\DocumentWish;
  6. use AppBundle\Entity\Core\ContactPoint;
  7. use AppBundle\Entity\Core\File;
  8. use AppBundle\Enum\Core\AddressPostalTypeEnum;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Dunglas\ApiBundle\Annotation\Iri;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. use Symfony\Component\Validator\Constraints as Assert;
  14. use AppBundle\Entity\Core\Country;
  15. use AppBundle\Entity\Traits\TimestampableEntity;
  16. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  17. use AppBundle\Entity\Bank\BankAccount;
  18. use FOS\UserBundle\Model\User as BaseUser;
  19. use AppBundle\Entity\Traits\AddressPostalType;
  20. use AppBundle\Annotation\Confidentiality;
  21. use AppBundle\Entity\Traits\ContactPointType;
  22. use AppBundle\Entity\Core\ContactInterface;
  23. /**
  24. * Personne physique ou morale
  25. *
  26. * @Iri("http://schema.org/Person")
  27. */
  28. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Person\Repository\PersonRepository')]
  29. class Person extends BaseUser implements ContactInterface
  30. {
  31. use TimestampableEntity;
  32. use CreatorUpdaterEntity;
  33. use AddressPostalType;
  34. use ContactPointType;
  35. /**
  36. * @var int
  37. */
  38. #[ORM\Column(type: 'integer')]
  39. #[ORM\Id]
  40. #[ORM\GeneratedValue(strategy: 'AUTO')]
  41. #[Groups(['person', 'access_details', 'access_mass', 'access_reference', 'all_accesses_list', 'student_list', 'guardians_list', 'teachers_list', 'adherent_list', 'personnels_list', 'morals_list', 'ca_list', 'accesses_list', 'rule', 'access_details_billingpayers', 'equipment_list_supplier', 'equipment_list_access', 'equipmentrent_list_borrower', 'equipmentloan_list_borrower', 'equipmentcontrol_list_accompanist', 'equipmentcontrol_list_equipment', 'equipmentrepair_list_provider', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'equipmentcostume_list_access', 'message_list_author', 'messagesend_list_author', 'template_list_author', 'othercontact_list', 'commission_list_commissionmembers', 'attendancebooking_list_access', 'donor_list_access', 'examenconvocation_list_student', 'medal_list_access', 'viewaudit_list_createdby', 'viewaudit_list_updatedby', 'my_student_list_access', 'planning_list', 'report_card', 'student_registration', 'student_registration_accessfamily', 'access_informations_edit', 'access_informations_edit_familymembers', 'equipment_details_editor', 'accesses_list_guardians', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list', 'own_access', 'own_student_access', 'accesscmfnetwork', 'board_list', 'licence_cmf', 'networkmanagers_list', 'my_access_put', 'adherent_contact', 'access_mail', 'accesses_rules', 'payer_list', 'equipmentmediatheque_list_access', 'sepa_debit_mandate', 'cotisation_responsibles_accesses', 'fusion_accesses', 'accessbilling_edit', 'view_from_manager_create', 'online_registration_access_details', 'access_files', 'accesses_no_reregistred_list', 'cmf_network_persons'])]
  42. protected $id;
  43. /**
  44. * @var string The username of the author.
  45. */
  46. #[ORM\Column(type: 'string', length: 255, nullable: true, unique: true)]
  47. #[Groups(['person', 'access_details_person', 'organization_create_access', 'student_list_person', 'guardians_list_person', 'accesses_list_person', 'adherent_list_person', 'board_list_person', 'ca_list_person', 'othercontact_list_person', 'personnels_list_person', 'teachers_list_person', 'all_accesses_list_person', 'payer_list_person'])]
  48. protected $username;
  49. /**
  50. * @var string The username of the author.
  51. */
  52. #[ORM\Column(name: 'username_canonical', type: 'string', length: 255, nullable: true, unique: true)]
  53. protected $usernameCanonical;
  54. /**
  55. * @var string The email of the user.
  56. *
  57. */
  58. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  59. #[Groups(['person'])]
  60. protected $email;
  61. /**
  62. * @var string The email of the user.
  63. */
  64. #[ORM\Column(name: 'email_canonical', type: 'string', length: 255, nullable: true)]
  65. protected $emailCanonical;
  66. /**
  67. * @var boolean
  68. */
  69. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  70. #[Groups(['organization_create', 'all_accesses_list_person'])]
  71. protected $enabled = false;
  72. /**
  73. * The salt to use for hashing
  74. *
  75. * @var string
  76. */
  77. #[ORM\Column(type: 'string', options: ['default' => ''])]
  78. #[Groups(['organization_create'])]
  79. protected $salt;
  80. /**
  81. * Encrypted password. Must be persisted.
  82. *
  83. * @var string
  84. *
  85. */
  86. #[ORM\Column(type: 'string', nullable: true)]
  87. #[Groups(['organization_create', 'organization_create_access'])]
  88. protected $password;
  89. /**
  90. * @var \DateTime
  91. */
  92. #[ORM\Column(name: 'last_login', type: 'datetime', nullable: true)]
  93. protected $lastLogin;
  94. /**
  95. * Random string sent to the user email address in order to verify it
  96. *
  97. * @var string
  98. */
  99. #[ORM\Column(name: 'confirmation_token', type: 'string', nullable: true)]
  100. #[Groups(['person'])]
  101. protected $confirmationToken;
  102. /**
  103. * @var \DateTime
  104. */
  105. #[ORM\Column(name: 'password_requested_at', type: 'datetime', nullable: true)]
  106. protected $passwordRequestedAt;
  107. /**
  108. * @var boolean
  109. */
  110. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  111. protected $locked = false;
  112. /**
  113. * @var boolean
  114. */
  115. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  116. protected $expired = false;
  117. /**
  118. * @var \DateTime
  119. */
  120. #[ORM\Column(name: 'expires_at', type: 'datetime', nullable: true)]
  121. public $expiresAt;
  122. /**
  123. * @var array
  124. */
  125. #[ORM\Column(type: 'array')]
  126. protected $roles;
  127. /**
  128. * @var boolean
  129. */
  130. #[ORM\Column(name: 'credentials_expired', type: 'boolean', options: ['default' => false])]
  131. protected $credentialsExpired = false;
  132. /**
  133. * @var \DateTime
  134. */
  135. #[ORM\Column(name: 'credentials_expire_at', type: 'datetime', nullable: true)]
  136. protected $credentialsExpireAt;
  137. /**
  138. * @var ArrayCollection<PersonAddressPostal>
  139. */
  140. #[Assert\Valid]
  141. #[Groups(['person_personaddresspostal', 'all_accesses_list_person', 'access_details_person', 'morals_list_person', 'report_card_person', 'report_card_guardians', 'access_details_guardians', 'student_registration_person', 'student_registration_guardians', 'accesses_list_person', 'student_list_person', 'education_student_next_year_access', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'access_duplicate_control_list_person', 'board_list_person', 'networkmanagers_list_person', 'payer_list_person', 'sepa_debit_mandate_person', 'student_list_guardians', 'equipment_availability_form_borrower', 'view_from_manager_create_person', 'online_registration_access_details_person', 'build_bills_access'])]
  142. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\PersonAddressPostal', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
  143. private $personAddressPostal;
  144. /**
  145. * @var ArrayCollection<PersonAddressPostal>
  146. */
  147. #[Groups(['template'])]
  148. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\PersonAddressPostal', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'], fetch: 'EXTRA_LAZY')]
  149. private $personAddressPostalPrincipal;
  150. #[Assert\Valid]
  151. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\ContactPoint', cascade: ['persist'], orphanRemoval: true, inversedBy: 'person')]
  152. #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
  153. #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
  154. #[ORM\JoinColumn(name: 'contactPoint_id', referencedColumnName: 'id')]
  155. #[Groups(['all_accesses_list_person', 'person_contactpoint', 'access_details_person', 'access_details_guardians', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'accesses_list_person', 'othercontact_list_person', 'report_card_person', 'report_card_guardians', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_familymembers', 'board_list_person', 'networkmanagers_list_person', 'network_list_adminaccess', 'adherent_contact_person', 'adherent_contact_guardians', 'access_mail_person', 'student_list_guardians', 'access_mail_guardians', 'payer_list_person', 'access_duplicate_control_list_person', 'view_from_manager_create_person', 'online_registration_access_details_person', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians'])]
  156. private $contactPoint;
  157. #[Assert\Valid]
  158. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Bank\BankAccount', inversedBy: 'person', cascade: ['persist'], orphanRemoval: true)]
  159. #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
  160. #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
  161. #[ORM\JoinColumn(name: 'bankAccount_id', referencedColumnName: 'id')]
  162. #[Groups(['person_bankaccount', 'access_details_person', 'sepa_debit_mandate_person', 'build_bills_access'])]
  163. private $bankAccount;
  164. /**
  165. * @var File An image of the item. This can be a [URL](http://schema.org/URL) or a fully described [ImageObject](http://schema.org/ImageObject).
  166. *
  167. * @Iri("https://schema.org/image")
  168. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  169. */
  170. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\File', inversedBy: 'personImages')]
  171. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  172. #[Groups(['person', 'access_details_person', 'adherent_list_person', 'ca_list_person', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'all_accesses_list_person', 'licence_cmf_person', 'networkmanagers_list_person', 'own_access_person', 'own_student_access_person', 'adherent_contact_person', 'access_details_children', 'online_registration_access_details_person'])]
  173. private $image;
  174. /**
  175. * @var \DateTime Date of birth.
  176. *
  177. * @Iri("https://schema.org/birthDate")
  178. */
  179. #[ORM\Column(type: 'date', nullable: true)]
  180. #[Assert\Date(message: 'invalid-date')]
  181. #[Groups(['person', 'access_details_person', 'student_list_person', 'rule_person', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'own_access_person', 'own_student_access_person', 'board_list_person', 'access_duplicate_control_list_person', 'fusion_accesses_person', 'online_registration_access_details_person', 'education_student_next_year_access'])]
  182. private $birthDate;
  183. /**
  184. * @var string Gender of the person.
  185. */
  186. #[ORM\Column(type: 'string', nullable: true)]
  187. #[Assert\Type(type: 'string')]
  188. #[Assert\Choice(callback: ['\AppBundle\Enum\Person\GenderEnum', 'toArray'], message: 'invalid-choice')]
  189. #[Groups(['person', 'access_details_person', 'adherent_list_person', 'ca_list_person', 'rule_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'othercontact_list_person', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'board_list_person', 'licence_cmf_person', 'networkmanagers_list_person', 'own_access_person', 'adherent_contact_person', 'accesses_rules_person', 'payer_list_person', 'access_duplicate_control_list_person', 'access_details_children', 'student_list_guardians', 'fusion_accesses_person', 'all_accesses_list_person', 'equipment_availability_form_borrower', 'education_student_next_year_access', 'online_registration_access_details_person', 'accesses_no_reregistred_list_person', 'build_bills_access'])]
  190. private $gender;
  191. /**
  192. * @var Country Nationality of the person.
  193. *
  194. * @Iri("https://schema.org/nationality")
  195. */
  196. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\Country')]
  197. #[Groups(['person', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'fusion_accesses_person'])]
  198. private $nationality;
  199. /**
  200. * @var string The place where the person was born.
  201. *
  202. * @Iri("https://schema.org/birthPlace")
  203. */
  204. #[ORM\Column(type: 'string', length: 50, nullable: true)]
  205. #[Assert\Type(type: 'string')]
  206. #[Groups(['person', 'student_registration_person', 'accesses_list_person', 'access_informations_edit_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'own_access_person', 'own_student_access_person'])]
  207. private $birthPlace;
  208. /**
  209. * @var string
  210. */
  211. #[ORM\Column(type: 'string', nullable: true)]
  212. #[Assert\Type(type: 'string')]
  213. #[Assert\Choice(callback: ['\AppBundle\Enum\Person\InseeEnum', 'toArray'])]
  214. #[Groups(['person', 'access_mass_person', 'access_informations_edit_person', 'accesses_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'student_registration_person', 'fusion_accesses_person'])]
  215. private $insee;
  216. /**
  217. * @var string
  218. */
  219. #[ORM\Column(type: 'string', nullable: true)]
  220. #[Assert\Type(type: 'string')]
  221. #[Groups(['person', 'access_informations_edit_person'])]
  222. private $website;
  223. /**
  224. * @var string Given name. In the U.S., the first name of a Person. This can be used along with name instead of the name property.
  225. *
  226. * @Iri("https://schema.org/givenName")
  227. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  228. */
  229. #[ORM\Column(type: 'string', length: 50, nullable: true)]
  230. #[Assert\Type(type: 'string')]
  231. #[Assert\Length(max: 50, maxMessage: 'invalid-max-length')]
  232. #[Groups(['person', 'template', 'access_reference_person', 'student_list_guardians', 'student_list_person', 'access_details_person', 'access_details_guardians', 'access_details_children', 'access_details_companyperson', 'access_details_accessfamily', 'guardians_list_person', 'teachers_list_person', 'student_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'accesses_list_person', 'rule_person', 'access_details_billingpayers', 'billaccounting_list_billlines', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'othercontact_list_person', 'donor_list_access', 'medal_list_access', 'viewaudit_list_updatedby', 'viewaudit_list_createdby', 'my_student_list_access', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'access_details_educationstudent', 'access_details_companypersonaccesses', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'equipment_details_editor', 'equipment_details_managercontrol', 'equipment_details_equipmentloanfiltered', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list_person', 'event_details_organizer', 'board_list_person', 'event_details_eventuserfiltered', 'examen_details_convocation', 'examen_details_jury', 'course_details_organizer', 'course_details_students', 'educationalproject_details_silentpartner', 'educationalproject_details_billingreceivers', 'educationalproject_details_organizer', 'licence_cmf_person', 'networkmanagers_list_person', 'educationstudent_reference_access', 'educationstudent_reference_teachers', 'educationteacher_reference_teacher', 'adherent_contact_person', 'adherent_contact_guardians', 'own_access_person', 'access_details_accessfamily', 'accesses_rules_person', 'billpayment_list_bill', 'organization_details_organizationlicences', 'payer_list_person', 'payer_list_billingpayers', 'invitations_list_guest', 'all_accesses_list_person', 'event_details_eventuser', 'billcredit_list_access', 'equipment_list_equipmentloan', 'equipmentmediatheque_list_equipmentloan', 'equipmentcostume_list_equipmentloan', 'sepa_debit_mandate_person', 'cotisation_responsibles_accesses_person', 'fusion_accesses_person', 'equipment_availability_form_borrower', 'course_details_attendancebooking', 'examen_details_attendancebooking', 'educationalproject_details_attendancebooking', 'event_details_attendancebooking', 'equipment_availability_form_borrower', 'education_input_list_teachers', 'education_input_list_access', 'view_from_manager_create_person', 'bill_list_billlines', 'education_student_next_year_access', 'online_registration_access_details_person', 'access_intangible_list_access', 'accesses_no_reregistred_list_person', 'accessholidays_list_access', 'educationstudent_notation_access', 'email_detail_author', 'cmf_network_persons_person', 'build_bills_access', 'build_bills_billlines'])]
  233. private $givenName;
  234. /**
  235. * @var string The name of the item.
  236. *
  237. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  238. * @Iri("https://schema.org/name")
  239. */
  240. #[ORM\Column(type: 'string', length: 100, nullable: true)]
  241. #[Assert\Type(type: 'string')]
  242. #[Assert\Length(max: 100, maxMessage: 'invalid-max-length')]
  243. #[Groups(['person', 'template', 'access_reference_person', 'morals_list_person', 'access_details_person', 'student_list_person', 'access_details_accessfamily', 'access_details_guardians', 'access_details_children', 'access_details_companyperson', 'access_details_accessfamily', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'accesses_list_person', 'rule_person', 'access_details_billingpayers', 'billaccounting_list_billlines', 'equipment_list_supplier', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'othercontact_list_person', 'donor_list_access', 'equipmentcostume_list_access', 'medal_list_access', 'viewaudit_list_updatedby', 'viewaudit_list_createdby', 'my_student_list_access', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'access_details_educationstudent', 'access_details_companypersonaccesses', 'access_details_companypersoncompany', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'equipment_details_editor', 'equipment_details_supplier', 'educationstudent_notation_access', 'equipment_details_managercontrol', 'equipment_details_equipmentrepair', 'equipment_details_equipmentloanfiltered', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list_person', 'event_details_organizer', 'board_list_person', 'event_details_eventuser', 'event_details_eventuserfiltered', 'examen_details_convocation', 'examen_details_jury', 'course_details_organizer', 'course_details_students', 'educationalproject_details_silentpartner', 'educationalproject_details_operationalpartner', 'educationalproject_details_financiers', 'educationalproject_details_billingreceivers', 'educationalproject_details_organizer', 'licence_cmf_person', 'networkmanagers_list_person', 'educationstudent_reference_access', 'educationstudent_reference_teachers', 'educationteacher_reference_teacher', 'adherent_contact_person', 'adherent_contact_guardians', 'own_access_person', 'access_details_accessfamily', 'equipmentmediatheque_list_editor', 'othercontact_list_companypersoncompany', 'accesses_rules_person', 'billpayment_list_bill', 'organization_details_organizationlicences', 'payer_list_person', 'all_accesses_list_person', 'payer_list_billingpayers', 'invitations_list_guest', 'event_details_eventuser', 'billcredit_list_access', 'student_list_guardians', 'equipment_list_equipmentloan', 'equipmentmediatheque_list_equipmentloan', 'equipmentcostume_list_equipmentloan', 'cotisation_responsibles_accesses_person', 'fusion_accesses_person', 'equipment_availability_form_borrower', 'course_details_attendancebooking', 'examen_details_attendancebooking', 'educationalproject_details_attendancebooking', 'event_details_attendancebooking', 'equipment_availability_form_borrower', 'education_input_list_access', 'education_input_list_teachers', 'view_from_manager_create_person', 'bill_list_billlines', 'education_student_next_year_access', 'online_registration_access_details_person', 'access_intangible_list_access', 'accesses_no_reregistred_list_person', 'accessholidays_list_access', 'email_detail_author', 'cmf_network_persons_person', 'build_bills_access', 'build_bills_billlines'])]
  244. private $name;
  245. /**
  246. * @var string
  247. *
  248. * @ExportSplitFields({"name","givenName"})
  249. */
  250. #[Groups(['person', 'message_list_author', 'messagesend_list_author', 'template_list_author', 'attendancebooking_list_access', 'bill_list_access', 'billaccounting_list_access', 'examenconvocation_list_student', 'guardians_list_children', 'commission_list_commissionmembers', 'morals_list_companypersonaccesses', 'student_list_guardians', 'placerepair_list_provider', 'equipmentcostume_list_access', 'equipmentcontrol_list_accompanist', 'equipmentcontrol_list_equipment', 'equipment_list_access', 'equipmentloan_list_borrower', 'equipmentrent_list_borrower', 'equipmentrepair_list_provider', 'presence_attendance_convocation', 'presence_attendance_students', 'presence_attendance_eventuser', 'accesses_list_guardians', 'adherent_list_guardians', 'equipment_details_equipmentloanfiltered', 'medal_list_access', 'attendance_list_access', 'attendance_list_replacement', 'donor_list_access', 'adherent_contact_guardians', 'student_list_educationstudent', 'billpayment_list_bill', 'educationnotation_list_educationstudent', 'planning_detail_organizer', 'planning_detail_students', 'planning_detail_attendancebooking', 'planning_detail_convocation', 'planning_detail_jury', 'payer_list_billingpayers', 'all_accesses_list_person', 'billcredit_list_access', 'invitations_list_guest', 'equipmentmediatheque_list_access', 'education_input_list_access', 'education_input_list_teachers', 'education_student_next_year_teachers', 'education_student_next_year_educationstudentlastyear', 'attendancebooking_list_course', 'access_intangible_list_access', 'billpayment_list_bill', 'accesses_no_reregistred_list_educationstudent', 'accesses_no_reregistred_list_guardians', 'worksbyusers_db_work', 'accessholidays_list_access', 'payer_list_person', 'accessholidays_list_access', 'advancepayment_list_access', 'billpayment_list_accessbillingaccountbalancereimbursement', 'educationstudent_notation_access'])]
  251. private $fullNameTemplate;
  252. /**
  253. * @var string
  254. * @ExportSplitFields({"gender","name","givenName","contactPoint.email","contactPoint.telphoneTemplate","contactPoint.mobilPhoneTemplate"})
  255. */
  256. #[Groups(['student_list_guardians', 'accesses_list_guardians', 'adherent_list_guardians', 'accesses_no_reregistred_list_guardians'])]
  257. private $fullNameAndContactTemplate;
  258. /**
  259. * @var string
  260. */
  261. #[ORM\Column(type: 'string', nullable: true)]
  262. #[Assert\Type(type: 'string')]
  263. #[Assert\Choice(callback: ['\AppBundle\Enum\Person\MoralPersonTypeEnum', 'toArray'])]
  264. #[Groups(['person', 'morals_list_person', 'access_informations_edit_person', 'access_details_person'])]
  265. private $typeMoral;
  266. /**
  267. * @var bool
  268. */
  269. #[ORM\Column(type: 'boolean', options: ['default' => true])]
  270. #[Assert\Type(type: 'boolean')]
  271. #[Assert\NotNull]
  272. #[Groups(['person', 'access_reference_person', 'access_details_person', 'access_informations_edit_person', 'donor_list_access', 'accessbilling_edit_person'])]
  273. private $isPhysical = true;
  274. /**
  275. * @var bool
  276. */
  277. #[ORM\Column(type: 'boolean', options: ['default' => true])]
  278. #[Assert\Type(type: 'boolean')]
  279. #[Assert\NotNull]
  280. #[Groups(['person', 'access_informations_edit_person', 'student_registration_person', 'accesses_list_person', 'access_mass_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'own_access_person', 'own_student_access_person', 'access_details_person', 'fusion_accesses_person', 'online_registration_access_details_person'])]
  281. private $imageRight = true;
  282. /**
  283. * @var array
  284. */
  285. #[ORM\Column(type: 'json_array')]
  286. #[Assert\Type(type: 'array')]
  287. #[Groups(['person', 'access_mass_person', 'access_details_person'])]
  288. private $confidentiality = array();
  289. /**
  290. * @var Medical
  291. */
  292. #[Assert\Valid]
  293. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Person\Medical', inversedBy: 'person', cascade: ['persist'], fetch: 'EAGER')]
  294. #[ORM\JoinColumn(nullable: true)]
  295. #[Groups(['person', 'access_mass_person', 'access_details_person', 'access_details', 'student_registration_person', 'accesses_list_person', 'student_list_person', 'adherent_list_person', 'own_student_access_person', 'fusion_accesses_person', 'online_registration_access_details_person'])]
  296. private $medical;
  297. /**
  298. * @var ArrayCollection<Access>
  299. */
  300. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', mappedBy: 'person', orphanRemoval: true)]
  301. #[Groups(['person_access'])]
  302. private $access;
  303. /**
  304. * @var ArrayCollection<File>
  305. */
  306. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'person', orphanRemoval: true)]
  307. #[Groups(['person_file', 'access_details_person'])]
  308. private $files;
  309. /**
  310. * @var ArrayCollection<DisciplineOtherEstablishment>
  311. */
  312. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\DisciplineOtherEstablishment', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
  313. #[Groups(['person_disciplineotherestablishment', 'access_details_person'])]
  314. private $disciplineotherestablishments;
  315. /**
  316. * @var ArrayCollection<Qualification>
  317. */
  318. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\Qualification', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
  319. #[Groups(['person_qualification', 'access_informations_edit_person'])]
  320. private $qualifications;
  321. /**
  322. * @var ArrayCollection<SchoolingInEstablishment>
  323. */
  324. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\SchoolingInEstablishment', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
  325. #[Groups(['person_schoolinginestablishment', 'access_details_person'])]
  326. private $schoolingEstablisments;
  327. /**
  328. * @var ArrayCollection<TeacherSchoolingHistory>
  329. */
  330. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\TeacherSchoolingHistory', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
  331. #[Groups(['person_teacherschoolinghistory', 'access_details_person'])]
  332. private $teacherSchoolingHistories;
  333. /**
  334. * @var int
  335. */
  336. #[Groups(['template', 'student_list_person', 'guardians_list_person', 'personnels_list_person', 'othercontact_list_person', 'ca_list_person', 'adherent_list_person', 'accesses_list_person', 'teachers_list_person', 'board_list_person', 'education_student_next_year_access'])]
  337. protected $ageTemplate;
  338. /**
  339. * @var ArrayCollection|File[]
  340. */
  341. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'accessPersons', cascade: ['persist'])]
  342. #[ORM\OrderBy(['id' => 'DESC'])]
  343. #[Groups(['person_files', 'access_files_person'])]
  344. private $personFiles;
  345. /**
  346. * @var ArrayCollection|File[]
  347. */
  348. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'accessPersons', cascade: ['persist'], fetch: 'EXTRA_LAZY')]
  349. #[ORM\OrderBy(['id' => 'DESC'])]
  350. #[Groups(['access_details_person'])]
  351. private $personFilesFiltered;
  352. /**
  353. * @var int
  354. */
  355. #[ORM\Column(type: 'integer', nullable: true)]
  356. #[Groups(['my_access_put_person', 'own_access_person', 'access_details_person', 'person'])]
  357. private $accessFavorite = false;
  358. /**
  359. * @var \DateTime
  360. */
  361. #[ORM\Column(name: 'login_requested_at', type: 'datetime', nullable: true)]
  362. #[Groups(['person'])]
  363. private $loginRequestedAt;
  364. /**
  365. * @var string
  366. */
  367. #[ORM\Column(type: 'string', length: 150, nullable: true)]
  368. #[Assert\Type(type: 'string')]
  369. #[Assert\Length(max: 150, maxMessage: 'invalid-max-length')]
  370. #[Groups(['person', 'access_informations_edit_person'])]
  371. private $profession;
  372. /**
  373. * @var ArrayCollection<DocumentWish>
  374. */
  375. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\AccessWish\DocumentWish', mappedBy: 'personOwner', cascade: ['persist'], orphanRemoval: true)]
  376. #[Groups(['person_documentwishes', 'access_files_person', 'student_registration_person'])]
  377. private $documentWishes;
  378. public function __construct()
  379. {
  380. parent::__construct();
  381. $this->contactPoint = new ArrayCollection();
  382. $this->bankAccount = new ArrayCollection();
  383. $this->personAddressPostal = new ArrayCollection();
  384. $this->access = new ArrayCollection();
  385. $this->files = new ArrayCollection();
  386. $this->disciplineotherestablishments = new ArrayCollection();
  387. $this->qualifications = new ArrayCollection();
  388. $this->schoolingEstablisments = new ArrayCollection();
  389. $this->teacherSchoolingHistories = new ArrayCollection();
  390. $this->documentWishes = new ArrayCollection();
  391. }
  392. public function __toString()
  393. {
  394. return parent::__toString(); // TODO: Change the autogenerated stub
  395. }
  396. /**
  397. * Sets id.
  398. *
  399. * @param int $id
  400. *
  401. * @return $this
  402. */
  403. public function setId($id)
  404. {
  405. $this->id = $id;
  406. $this->setLegacyId($id);
  407. return $this;
  408. }
  409. /**
  410. * Gets id.
  411. *
  412. * @return int
  413. */
  414. public function getId()
  415. {
  416. return $this->id;
  417. }
  418. /**
  419. * Sets birthDate.
  420. *
  421. * @param \DateTime $birthDate
  422. *
  423. * @return $this
  424. */
  425. public function setBirthDate(\DateTime $birthDate = null)
  426. {
  427. $this->birthDate = $birthDate;
  428. return $this;
  429. }
  430. /**
  431. * Gets birthDate.
  432. *
  433. * @return \DateTime
  434. */
  435. public function getBirthDate()
  436. {
  437. return $this->birthDate ? $this->birthDate->format('Y-m-d') : $this->birthDate;
  438. }
  439. /**
  440. * Sets gender.
  441. *
  442. * @param string $gender
  443. *
  444. * @return $this
  445. */
  446. public function setGender($gender)
  447. {
  448. $this->gender = $gender;
  449. return $this;
  450. }
  451. /**
  452. * Gets gender.
  453. *
  454. * @return string
  455. */
  456. public function getGender()
  457. {
  458. return $this->gender;
  459. }
  460. /**
  461. * Sets givenName.
  462. *
  463. * @param string $givenName
  464. *
  465. * @return $this
  466. */
  467. public function setGivenName($givenName)
  468. {
  469. $this->givenName = $givenName;
  470. return $this;
  471. }
  472. /**
  473. * Gets givenName.
  474. *
  475. * @return string
  476. */
  477. public function getGivenName()
  478. {
  479. return $this->givenName;
  480. }
  481. /**
  482. * Sets nationality.
  483. *
  484. * @param Country $nationality
  485. *
  486. * @return $this
  487. */
  488. public function setNationality(Country $nationality = null)
  489. {
  490. $this->nationality = $nationality;
  491. return $this;
  492. }
  493. /**
  494. * Gets nationality.
  495. *
  496. * @return Country
  497. */
  498. public function getNationality()
  499. {
  500. return $this->nationality;
  501. }
  502. /**
  503. * Sets birthPlace.
  504. *
  505. * @param string $birthPlace
  506. *
  507. * @return $this
  508. */
  509. public function setBirthPlace($birthPlace)
  510. {
  511. $this->birthPlace = $birthPlace;
  512. return $this;
  513. }
  514. /**
  515. * Gets birthPlace.
  516. *
  517. * @return string
  518. */
  519. public function getBirthPlace()
  520. {
  521. return $this->birthPlace;
  522. }
  523. /**
  524. * Sets insee.
  525. *
  526. * @param string $insee
  527. *
  528. * @return $this
  529. */
  530. public function setInsee($insee)
  531. {
  532. $this->insee = $insee;
  533. return $this;
  534. }
  535. /**
  536. * Gets insee.
  537. *
  538. * @return string
  539. */
  540. public function getInsee()
  541. {
  542. return $this->insee;
  543. }
  544. /**
  545. * Sets website.
  546. *
  547. * @param string $website
  548. *
  549. * @return $this
  550. */
  551. public function setWebsite($website)
  552. {
  553. $this->website = $website;
  554. return $this;
  555. }
  556. /**
  557. * Gets website.
  558. *
  559. * @return string
  560. */
  561. public function getWebsite()
  562. {
  563. return $this->website;
  564. }
  565. /**
  566. * Sets image.
  567. *
  568. * @param string $image
  569. *
  570. * @return $this
  571. */
  572. public function setImage($image)
  573. {
  574. $this->image = $image;
  575. return $this;
  576. }
  577. /**
  578. * Gets image.
  579. *
  580. * @return string
  581. */
  582. public function getImage()
  583. {
  584. return $this->image;
  585. }
  586. /**
  587. * Sets email.
  588. *
  589. * @param string $email
  590. *
  591. * @return $this
  592. */
  593. public function setEmail($email)
  594. {
  595. $this->email = $email;
  596. return $this;
  597. }
  598. /**
  599. * Gets email.
  600. *
  601. * @return string
  602. */
  603. public function getEmail()
  604. {
  605. return $this->email;
  606. }
  607. /**
  608. * Sets username.
  609. *
  610. * @param string $username
  611. *
  612. * @return $this
  613. */
  614. public function setUsername($username)
  615. {
  616. $this->username = $username;
  617. return $this;
  618. }
  619. /**
  620. * Gets username.
  621. *
  622. * @return string
  623. */
  624. public function getUsername()
  625. {
  626. return $this->username;
  627. }
  628. /**
  629. * Sets password.
  630. *
  631. * @param string $password
  632. *
  633. * @return $this
  634. */
  635. public function setPassword($password)
  636. {
  637. $this->password = $password;
  638. return $this;
  639. }
  640. /**
  641. * Gets password.
  642. *
  643. * @return string
  644. */
  645. public function getPassword()
  646. {
  647. return $this->password;
  648. }
  649. /**
  650. * Sets name.
  651. *
  652. * @param string $name
  653. *
  654. * @return $this
  655. */
  656. public function setName($name)
  657. {
  658. $this->name = $this->isPhysical ? strtoupper($name) : $name;
  659. return $this;
  660. }
  661. /**
  662. * Gets name.
  663. *
  664. * @return string
  665. */
  666. public function getName()
  667. {
  668. return $this->isPhysical ? strtoupper($this->name) : $this->name;
  669. }
  670. /**
  671. * Sets typeMoral.
  672. *
  673. * @param string $typeMoral
  674. *
  675. * @return $this
  676. */
  677. public function setTypeMoral($typeMoral)
  678. {
  679. $this->typeMoral = $typeMoral;
  680. return $this;
  681. }
  682. /**
  683. * Gets typeMoral.
  684. *
  685. * @return string
  686. */
  687. public function getTypeMoral()
  688. {
  689. return $this->typeMoral;
  690. }
  691. /**
  692. * Add personAddressPostal
  693. *
  694. * @param PersonAddressPostal $personAddressPostal
  695. * @return Person
  696. */
  697. public function addPersonAddressPostal(PersonAddressPostal $personAddressPostal)
  698. {
  699. $personAddressPostal->setPerson($this);
  700. $this->personAddressPostal[] = $personAddressPostal;
  701. return $this;
  702. }
  703. /**
  704. * Remove personAddressPostal
  705. *
  706. * @param PersonAddressPostal $personAddressPostal
  707. */
  708. public function removePersonAddressPostal(PersonAddressPostal $personAddressPostal)
  709. {
  710. $this->personAddressPostal->removeElement($personAddressPostal);
  711. }
  712. /**
  713. * Get personAddressPostal
  714. *
  715. * @return \Doctrine\Common\Collections\Collection
  716. */
  717. public function getPersonAddressPostal()
  718. {
  719. return $this->personAddressPostal;
  720. }
  721. /**
  722. * Get personAddressPostal
  723. *
  724. * @return \Doctrine\Common\Collections\Collection
  725. */
  726. public function getPersonAddressPostalPrincipal()
  727. {
  728. $principal = [];
  729. foreach ($this->personAddressPostal as $personAddressPostal){
  730. if($personAddressPostal->getType() === AddressPostalTypeEnum::ADDRESS_PRINCIPAL){
  731. $principal = new ArrayCollection([$personAddressPostal]);
  732. }
  733. }
  734. return $principal;
  735. }
  736. /**
  737. * Add contact Point
  738. *
  739. * @param ContactPoint $contactPoint
  740. * @return Person
  741. */
  742. public function addContactPoint(ContactPoint $contactPoint)
  743. {
  744. $contactPoint->addPerson($this);
  745. $this->contactPoint[] = $contactPoint;
  746. return $this;
  747. }
  748. /**
  749. * Remove contact Point
  750. *
  751. * @param ContactPoint $contactPoint
  752. */
  753. public function removeContactPoint(ContactPoint $contactPoint)
  754. {
  755. $this->contactPoint->removeElement($contactPoint);
  756. }
  757. /**
  758. * Get contact Point
  759. *
  760. * @return \Doctrine\Common\Collections\Collection
  761. */
  762. public function getContactPoint()
  763. {
  764. return $this->contactPoint;
  765. }
  766. /**
  767. * Add bankAccount
  768. *
  769. * @param BankAccount $bankAccount
  770. * @return Person
  771. */
  772. public function addBankAccount(BankAccount $bankAccount)
  773. {
  774. $this->bankAccount[] = $bankAccount;
  775. $bankAccount->addPerson($this);
  776. return $this;
  777. }
  778. /**
  779. * Remove bankAccount
  780. *
  781. * @param BankAccount $bankAccount
  782. */
  783. public function removeBankAccount(BankAccount $bankAccount)
  784. {
  785. $this->bankAccount->removeElement($bankAccount);
  786. }
  787. /**
  788. * Get bankAccount
  789. *
  790. * @return \Doctrine\Common\Collections\Collection
  791. */
  792. public function getBankAccount()
  793. {
  794. return $this->bankAccount;
  795. }
  796. /**
  797. * Sets isPhysical.
  798. *
  799. * @param bool $isPhysical
  800. *
  801. * @return $this
  802. */
  803. public function setIsPhysical($isPhysical)
  804. {
  805. $this->isPhysical = $isPhysical;
  806. return $this;
  807. }
  808. /**
  809. * Gets isPhysical.
  810. *
  811. * @return bool
  812. */
  813. public function getIsPhysical()
  814. {
  815. return $this->isPhysical;
  816. }
  817. /**
  818. * Sets imageRight.
  819. *
  820. * @param bool $imageRight
  821. *
  822. * @return $this
  823. */
  824. public function setImageRight($imageRight)
  825. {
  826. $this->imageRight = $imageRight;
  827. return $this;
  828. }
  829. /**
  830. * Gets imageRight.
  831. *
  832. * @return bool
  833. */
  834. public function getImageRight()
  835. {
  836. return $this->imageRight;
  837. }
  838. /**
  839. * @return \DateTime
  840. */
  841. public function getCredentialsExpireAt()
  842. {
  843. return $this->credentialsExpireAt;
  844. }
  845. /**
  846. * @param \DateTime $credentialsExpireAt
  847. */
  848. public function setCredentialsExpireAt(\DateTime $credentialsExpireAt)
  849. {
  850. $this->credentialsExpireAt = $credentialsExpireAt;
  851. return $this;
  852. }
  853. /**
  854. * @return \DateTime
  855. */
  856. public function getExpiresAt()
  857. {
  858. return $this->expiresAt;
  859. }
  860. /**
  861. * @param \DateTime $expiresAt
  862. */
  863. public function setExpiresAt(\DateTime $expiresAt)
  864. {
  865. $this->expiresAt = $expiresAt;
  866. return $this;
  867. }
  868. public function setUsernameCanonical($usernameCanonical)
  869. {
  870. if (empty($usernameCanonical) || !isset($usernameCanonical))
  871. $this->usernameCanonical = NULL;
  872. else
  873. $this->usernameCanonical = $usernameCanonical;
  874. return $this;
  875. }
  876. public function getFullname()
  877. {
  878. return sprintf("%s %s", $this->getName(), $this->getGivenName());
  879. }
  880. /**
  881. * Get confidentiality
  882. *
  883. * @return array
  884. */
  885. public function getConfidentiality()
  886. {
  887. return $this->confidentiality ? $this->confidentiality : [];
  888. }
  889. /**
  890. * Set confidentiality
  891. *
  892. * @return Person
  893. */
  894. public function setConfidentiality(array $confidentiality)
  895. {
  896. $this->confidentiality = $confidentiality;
  897. return $this;
  898. }
  899. /**
  900. * Set medical
  901. *
  902. * @param \AppBundle\Entity\Person\Medical $medical
  903. *
  904. * @return Person
  905. */
  906. public function setMedical(\AppBundle\Entity\Person\Medical $medical = null)
  907. {
  908. $this->medical = $medical;
  909. return $this;
  910. }
  911. /**
  912. * Get medical
  913. *
  914. * @return \AppBundle\Entity\Person\Medical
  915. */
  916. public function getMedical()
  917. {
  918. return $this->medical;
  919. }
  920. /**
  921. * Get enabled
  922. *
  923. * @return boolean
  924. */
  925. public function getEnabled()
  926. {
  927. return $this->enabled;
  928. }
  929. /**
  930. * Set enabled
  931. *
  932. * @return boolean
  933. */
  934. public function setEnabled($enabled)
  935. {
  936. $this->enabled = $enabled;
  937. return $this;
  938. }
  939. /**
  940. * Set salt
  941. *
  942. * @param string $salt
  943. *
  944. * @return Person
  945. */
  946. public function setSalt($salt)
  947. {
  948. $this->salt = $salt;
  949. return $this;
  950. }
  951. /**
  952. * Get locked
  953. *
  954. * @return boolean
  955. */
  956. public function getLocked()
  957. {
  958. return $this->locked;
  959. }
  960. /**
  961. * Get expired
  962. *
  963. * @return boolean
  964. */
  965. public function getExpired()
  966. {
  967. return $this->expired;
  968. }
  969. /**
  970. * Get credentialsExpired
  971. *
  972. * @return boolean
  973. */
  974. public function getCredentialsExpired()
  975. {
  976. return $this->credentialsExpired;
  977. }
  978. /**
  979. * Add access
  980. *
  981. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  982. *
  983. * @return Person
  984. */
  985. public function addAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
  986. {
  987. $access->setPerson($this);
  988. $this->access[] = $access;
  989. return $this;
  990. }
  991. /**
  992. * Remove access
  993. *
  994. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  995. */
  996. public function removeAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
  997. {
  998. $this->access->removeElement($access);
  999. }
  1000. /**
  1001. * Get access
  1002. *
  1003. * @return \Doctrine\Common\Collections\Collection
  1004. */
  1005. public function getAccess()
  1006. {
  1007. return $this->access;
  1008. }
  1009. /**
  1010. * Add file
  1011. *
  1012. * @param \AppBundle\Entity\Core\File $file
  1013. *
  1014. * @return Person
  1015. */
  1016. public function addFile(\AppBundle\Entity\Core\File $file)
  1017. {
  1018. $this->files[] = $file;
  1019. return $this;
  1020. }
  1021. /**
  1022. * Remove file
  1023. *
  1024. * @param \AppBundle\Entity\Core\File $file
  1025. */
  1026. public function removeFile(\AppBundle\Entity\Core\File $file)
  1027. {
  1028. $this->files->removeElement($file);
  1029. }
  1030. /**
  1031. * Get files
  1032. *
  1033. * @return \Doctrine\Common\Collections\Collection
  1034. */
  1035. public function getFiles()
  1036. {
  1037. return $this->files;
  1038. }
  1039. /**
  1040. * Add disciplineotherestablishment
  1041. *
  1042. * @param \AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment
  1043. *
  1044. * @return Person
  1045. */
  1046. public function addDisciplineotherestablishment(\AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment)
  1047. {
  1048. $disciplineotherestablishment->setPerson($this);
  1049. $this->disciplineotherestablishments[] = $disciplineotherestablishment;
  1050. return $this;
  1051. }
  1052. /**
  1053. * Remove disciplineotherestablishment
  1054. *
  1055. * @param \AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment
  1056. */
  1057. public function removeDisciplineotherestablishment(\AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment)
  1058. {
  1059. $this->disciplineotherestablishments->removeElement($disciplineotherestablishment);
  1060. }
  1061. /**
  1062. * Get disciplineotherestablishments
  1063. *
  1064. * @return \Doctrine\Common\Collections\Collection
  1065. */
  1066. public function getDisciplineotherestablishments()
  1067. {
  1068. return $this->disciplineotherestablishments;
  1069. }
  1070. /**
  1071. * Add qualification
  1072. *
  1073. * @param \AppBundle\Entity\Person\Qualification $qualification
  1074. *
  1075. * @return Person
  1076. */
  1077. public function addQualification(\AppBundle\Entity\Person\Qualification $qualification)
  1078. {
  1079. $qualification->setPerson($this);
  1080. $this->qualifications[] = $qualification;
  1081. return $this;
  1082. }
  1083. /**
  1084. * Remove qualification
  1085. *
  1086. * @param \AppBundle\Entity\Person\Qualification $qualification
  1087. */
  1088. public function removeQualification(\AppBundle\Entity\Person\Qualification $qualification)
  1089. {
  1090. $this->qualifications->removeElement($qualification);
  1091. }
  1092. /**
  1093. * Get qualifications
  1094. *
  1095. * @return \Doctrine\Common\Collections\Collection
  1096. */
  1097. public function getQualifications()
  1098. {
  1099. return $this->qualifications;
  1100. }
  1101. /**
  1102. * Add schoolingEstablisment
  1103. *
  1104. * @param \AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment
  1105. *
  1106. * @return Person
  1107. */
  1108. public function addSchoolingEstablisment(\AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment)
  1109. {
  1110. $schoolingEstablisment->setPerson($this);
  1111. $this->schoolingEstablisments[] = $schoolingEstablisment;
  1112. return $this;
  1113. }
  1114. /**
  1115. * Remove schoolingEstablisment
  1116. *
  1117. * @param \AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment
  1118. */
  1119. public function removeSchoolingEstablisment(\AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment)
  1120. {
  1121. $this->schoolingEstablisments->removeElement($schoolingEstablisment);
  1122. }
  1123. /**
  1124. * Get schoolingEstablisments
  1125. *
  1126. * @return \Doctrine\Common\Collections\Collection
  1127. */
  1128. public function getSchoolingEstablisments()
  1129. {
  1130. return $this->schoolingEstablisments;
  1131. }
  1132. /**
  1133. * Add teacherSchoolingHistory
  1134. *
  1135. * @param \AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory
  1136. *
  1137. * @return Person
  1138. */
  1139. public function addTeacherSchoolingHistory(\AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory)
  1140. {
  1141. $teacherSchoolingHistory->setPerson($this);
  1142. $this->teacherSchoolingHistories[] = $teacherSchoolingHistory;
  1143. return $this;
  1144. }
  1145. /**
  1146. * Remove teacherSchoolingHistory
  1147. *
  1148. * @param \AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory
  1149. */
  1150. public function removeTeacherSchoolingHistory(\AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory)
  1151. {
  1152. $this->teacherSchoolingHistories->removeElement($teacherSchoolingHistory);
  1153. }
  1154. /**
  1155. * Get teacherSchoolingHistories
  1156. *
  1157. * @return \Doctrine\Common\Collections\Collection
  1158. */
  1159. public function getTeacherSchoolingHistories()
  1160. {
  1161. return $this->teacherSchoolingHistories;
  1162. }
  1163. /**
  1164. * Gets age.
  1165. *
  1166. * @return int
  1167. */
  1168. public function getAgeTemplate()
  1169. {
  1170. $from = new \DateTime($this->getBirthDate());
  1171. $to = new \DateTime('today');
  1172. $age = $from->diff($to)->y;
  1173. return $age > 0 ? $age : null;
  1174. }
  1175. /**
  1176. * Gets full name.
  1177. *
  1178. * @return string
  1179. */
  1180. public function getFullNameTemplate()
  1181. {
  1182. return $this->getName() . ' ' . $this->getGivenName();
  1183. }
  1184. /**
  1185. * Gets full name.
  1186. *
  1187. * @return string
  1188. */
  1189. public function getFullNameAndContactTemplate()
  1190. {
  1191. $fullNameAndContactTemplate[] = [ 'value' => $this->getGender(), 'translate' => true ];
  1192. $fullNameAndContactTemplate[] = ' - ';
  1193. $fullNameAndContactTemplate[] = $this->getFullNameTemplate();
  1194. foreach ($this->getContactPoint() as $contactPoint) {
  1195. $fullNameAndContactTemplate[] = ' - ';
  1196. $fullNameAndContactTemplate[] = [ 'value' => $contactPoint->getContactType(), 'translate' => true ];
  1197. $fullNameAndContactTemplate[] = ' : ';
  1198. // $fullNameAndContactTemplate = array_merge($fullNameAndContactTemplate, $contactPoint->getFullLabelTemplate());
  1199. }
  1200. return $fullNameAndContactTemplate;
  1201. }
  1202. /**
  1203. * Add personFile
  1204. *
  1205. * @param \AppBundle\Entity\Core\File $personFile
  1206. *
  1207. * @return Person
  1208. */
  1209. public function addPersonFile(\AppBundle\Entity\Core\File $personFile)
  1210. {
  1211. $this->personFiles[] = $personFile;
  1212. return $this;
  1213. }
  1214. /**
  1215. * Remove personFile
  1216. *
  1217. * @param \AppBundle\Entity\Core\File $personFile
  1218. */
  1219. public function removePersonFile(\AppBundle\Entity\Core\File $personFile)
  1220. {
  1221. $this->personFiles->removeElement($personFile);
  1222. }
  1223. /**
  1224. * Get personFiles
  1225. *
  1226. * @return \Doctrine\Common\Collections\Collection
  1227. */
  1228. public function getPersonFiles()
  1229. {
  1230. return $this->personFiles;
  1231. }
  1232. /**
  1233. * Get personFilesFiltered
  1234. *
  1235. * @return \Doctrine\Common\Collections\Collection
  1236. */
  1237. public function getPersonFilesFiltered()
  1238. {
  1239. return $this->personFiles ? $this->personFiles->slice(0, 5) : [];
  1240. }
  1241. /**
  1242. * @return Access
  1243. */
  1244. public function getAccessFavorite()
  1245. {
  1246. return $this->accessFavorite;
  1247. }
  1248. /**
  1249. * @param int $accessFavorite
  1250. */
  1251. public function setAccessFavorite($accessFavorite)
  1252. {
  1253. $this->accessFavorite = $accessFavorite;
  1254. }
  1255. public function setLoginRequestedAt(\DateTime $date = null)
  1256. {
  1257. $this->loginRequestedAt = $date;
  1258. return $this;
  1259. }
  1260. /**
  1261. * Gets the timestamp that the user requested a auto login.
  1262. *
  1263. * @return null|\DateTime
  1264. */
  1265. public function getLoginRequestedAt()
  1266. {
  1267. return $this->loginRequestedAt;
  1268. }
  1269. public function isLoginRequestNonExpired($ttl)
  1270. {
  1271. return $this->getLoginRequestedAt() instanceof \DateTime &&
  1272. $this->getLoginRequestedAt()->getTimestamp() + $ttl > time();
  1273. }
  1274. /**
  1275. *
  1276. * {@inheritdoc}
  1277. */
  1278. public function getContact()
  1279. {
  1280. return $this;
  1281. }
  1282. /**
  1283. *
  1284. * {@inheritdoc}
  1285. */
  1286. public function getContactAddress()
  1287. {
  1288. return $this->getAddressPostalForType(\AppBundle\Enum\Core\AddressPostalTypeEnum::ADDRESS_PRINCIPAL);
  1289. }
  1290. /**
  1291. *
  1292. * {@inheritdoc}
  1293. */
  1294. public function getContactContactPoint()
  1295. {
  1296. return $this->getContactPointPrincipal();
  1297. }
  1298. /**
  1299. *
  1300. * {@inheritdoc}
  1301. */
  1302. public function getContactName()
  1303. {
  1304. return $this->getFullname();
  1305. }
  1306. /**
  1307. * Set profession
  1308. *
  1309. * @param string $profession
  1310. *
  1311. * @return Person
  1312. */
  1313. public function setProfession($profession)
  1314. {
  1315. $this->profession = $profession;
  1316. return $this;
  1317. }
  1318. /**
  1319. * Get profession
  1320. *
  1321. * @return string
  1322. */
  1323. public function getProfession()
  1324. {
  1325. return $this->profession;
  1326. }
  1327. /**
  1328. * Add documentWish
  1329. *
  1330. * @param \AppBundle\Entity\AccessWish\DocumentWish $documentWish
  1331. *
  1332. * @return Person
  1333. */
  1334. public function addDocumentWish(\AppBundle\Entity\AccessWish\DocumentWish $documentWish)
  1335. {
  1336. $documentWish->setPersonOwner($this);
  1337. $this->documentWishes[] = $documentWish;
  1338. return $this;
  1339. }
  1340. /**
  1341. * Remove documentWish
  1342. *
  1343. * @param \AppBundle\Entity\AccessWish\DocumentWish $documentWish
  1344. */
  1345. public function removeDocumentWish(\AppBundle\Entity\AccessWish\DocumentWish $documentWish)
  1346. {
  1347. $this->documentWishes->removeElement($documentWish);
  1348. }
  1349. /**
  1350. * Get documentWishes
  1351. *
  1352. * @return \Doctrine\Common\Collections\Collection
  1353. */
  1354. public function getDocumentWishes()
  1355. {
  1356. return $this->documentWishes;
  1357. }
  1358. }