src/AdminBundle/Entity/User.php line 15

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Ramsey\Uuid\Uuid;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Sonata\UserBundle\Entity\BaseUser;
  7. /**
  8. * This file has been generated by the Sonata EasyExtends bundle.
  9. */
  10. #[ORM\Table(name: 'user')]
  11. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\UserRepository::class)]
  12. class User extends BaseUser
  13. {
  14. const ROLE_ADMIN = 'ROLE_ADMIN';
  15. const ROLE_OPERATOR = 'ROLE_OPERATOR';
  16. const ROLE_OPERATOR_ADMIN = 'ROLE_OPERATOR_ADMIN';
  17. const ROLE_CLIENT = 'ROLE_CLIENT';
  18. const ROLE_DRIVER = 'ROLE_DRIVER';
  19. const ROLE_COMPANY = 'ROLE_COMPANY';
  20. const ROLE_API = 'ROLE_API';
  21. const BRAINTREE_CUSTOMER = 1;
  22. const STRIPE_CUSTOMER = 5;
  23. public const SYSTEM_USER_USERNAME = 'system@ctlf.co.uk';
  24. /**
  25. * @var integer
  26. */
  27. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  28. #[ORM\Id]
  29. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  30. protected $id;
  31. /**
  32. * Old FosUser columns - props -- start
  33. */
  34. #[ORM\Column(name: 'two_step_code', type: 'string', nullable: true, length: 255)]
  35. protected $twoStepVerificationCode;
  36. #[ORM\Column(name: 'date_of_birth', type: 'datetime', nullable: true)]
  37. protected $dateOfBirth;
  38. #[ORM\Column(name: 'firstname', type: 'string', nullable: true, length: 64)]
  39. protected $firstname;
  40. #[ORM\Column(name: 'lastname', type: 'string', nullable: true, length: 64)]
  41. protected $lastname;
  42. #[ORM\Column(name: 'website', type: 'string', nullable: true, length: 64)]
  43. protected $website;
  44. #[ORM\Column(name: 'biography', type: 'string', nullable: true, length: 1000)]
  45. protected $biography;
  46. #[ORM\Column(name: 'gender', type: 'string', nullable: true, length: 1)]
  47. protected $gender = null;
  48. #[ORM\Column(name: 'locale', type: 'string', nullable: true, length: 8)]
  49. protected $locale;
  50. #[ORM\Column(name: 'timezone', type: 'string', nullable: true, length: 64)]
  51. protected $timezone;
  52. #[ORM\Column(name: 'phone', type: 'string', nullable: true, length: 64)]
  53. protected $phone;
  54. #[ORM\Column(name: 'facebook_uid', type: 'string', nullable: true, length: 255)]
  55. protected $facebookUid;
  56. #[ORM\Column(name: 'facebook_name', type: 'string', nullable: true, length: 255)]
  57. protected $facebookName;
  58. #[ORM\Column(name: 'facebook_data', type: 'json', nullable: true)]
  59. protected $facebookData;
  60. #[ORM\Column(name: 'twitter_uid', type: 'string', nullable: true, length: 255)]
  61. protected $twitterUid;
  62. #[ORM\Column(name: 'twitter_name', type: 'string', nullable: true, length: 255)]
  63. protected $twitterName;
  64. #[ORM\Column(name: 'twitter_data', type: 'json', nullable: true)]
  65. protected $twitterData;
  66. #[ORM\Column(name: 'gplus_uid', type: 'string', nullable: true, length: 255)]
  67. protected $gplusUid;
  68. #[ORM\Column(name: 'gplus_name', type: 'string', nullable: true, length: 255)]
  69. protected $gplusName;
  70. #[ORM\Column(name: 'gplus_data', type: 'json', nullable: true)]
  71. protected $gplusData;
  72. #[ORM\Column(name: 'token', type: 'string', nullable: true, length: 255)]
  73. protected $token;
  74. /**
  75. * Old FosUser columns - props -- end
  76. */
  77. /**
  78. * @var Account
  79. */
  80. #[ORM\OneToOne(targetEntity: \Account::class, mappedBy: 'user')]
  81. private $account;
  82. /**
  83. * @var Company
  84. */
  85. #[ORM\OneToOne(targetEntity: \AdminBundle\Entity\Company::class, mappedBy: 'user')]
  86. private $company;
  87. /**
  88. * @var Driver
  89. */
  90. #[ORM\OneToOne(targetEntity: \AdminBundle\Entity\Driver::class, mappedBy: 'user', cascade: ['persist'])]
  91. private $driver;
  92. /**
  93. * @var string
  94. */
  95. #[ORM\Column(name: 'api_key', type: 'string', length: 64, nullable: true, unique: true)]
  96. protected $apiKey;
  97. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\ChangeRequests::class, mappedBy: 'fromUser')]
  98. private $changeRequests;
  99. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\ClientChangeRequest::class, mappedBy: 'fromUser')]
  100. private $clientChangeRequests;
  101. /**
  102. * @var string
  103. */
  104. #[ORM\Column(name: 'allow_ips_to_login', type: 'text', nullable: true)]
  105. private $allowIpsToLogin;
  106. /**
  107. * @var string
  108. */
  109. #[ORM\Column(name: 'device_uid', type: 'string', length: 264, nullable: true, unique: false)]
  110. protected $deviceUid;
  111. /**
  112. * @var string
  113. */
  114. #[ORM\Column(name: 'device_xid', type: 'string', length: 64, nullable: true, unique: false)]
  115. protected $deviceXid;
  116. /**
  117. * @var string
  118. */
  119. #[ORM\Column(name: 'device_application_name', type: 'string', length: 64, nullable: true, unique: false)]
  120. protected $deviceApplicationName;
  121. /**
  122. * @var string
  123. */
  124. #[ORM\Column(name: 'device_application_version', type: 'string', length: 64, nullable: true, unique: false)]
  125. protected $deviceApplicationVersion;
  126. /**
  127. * @var string
  128. */
  129. #[ORM\Column(name: 'device_model', type: 'string', length: 64, nullable: true, unique: false)]
  130. protected $deviceModel;
  131. /**
  132. * @var string
  133. */
  134. #[ORM\Column(name: 'device_product', type: 'string', length: 64, nullable: true, unique: false)]
  135. protected $deviceProduct;
  136. /**
  137. * @var string
  138. */
  139. #[ORM\Column(name: 'device_type', type: 'string', length: 64, nullable: true, unique: false)]
  140. protected $deviceType;
  141. /**
  142. * @var string
  143. */
  144. #[ORM\Column(name: 'device_vendor', type: 'string', length: 64, nullable: true, unique: false)]
  145. protected $deviceVendor;
  146. /**
  147. * @var string
  148. */
  149. #[ORM\Column(name: 'device_os_api_version', type: 'string', length: 64, nullable: true, unique: false)]
  150. protected $deviceOsApiVersion;
  151. /**
  152. * @var string
  153. */
  154. #[ORM\Column(name: 'device_os_type', type: 'string', length: 64, nullable: true, unique: false)]
  155. protected $deviceOsType;
  156. /**
  157. * @var string
  158. */
  159. #[ORM\Column(name: 'device_os_version', type: 'string', length: 64, nullable: true, unique: false)]
  160. protected $deviceOsVersion;
  161. /**
  162. * @var string
  163. */
  164. #[ORM\Column(name: 'device_sandbox', type: 'string', length: 64, nullable: true, unique: false)]
  165. protected $deviceSandbox;
  166. /**
  167. * @var string
  168. */
  169. #[ORM\Column(name: 'device_screen_density', type: 'string', length: 64, nullable: true, unique: false)]
  170. protected $deviceScreenDensity;
  171. /**
  172. * @var string
  173. */
  174. #[ORM\Column(name: 'device_screen_height', type: 'string', length: 64, nullable: true, unique: false)]
  175. protected $deviceScreenHeight;
  176. /**
  177. * @var string
  178. */
  179. #[ORM\Column(name: 'device_screen_orientation', type: 'string', length: 64, nullable: true, unique: false)]
  180. protected $deviceScreenOrientation;
  181. /**
  182. * @var string
  183. */
  184. #[ORM\Column(name: 'device_screen_width', type: 'string', length: 64, nullable: true, unique: false)]
  185. protected $deviceScreenWidth;
  186. /**
  187. * @var string
  188. */
  189. #[ORM\Column(name: 'device_time_zone', type: 'string', length: 64, nullable: true, unique: false)]
  190. protected $deviceTimeZone;
  191. /**
  192. * @var string
  193. */
  194. #[ORM\Column(name: 'device_datetime', type: 'string', length: 64, nullable: true, unique: false)]
  195. protected $deviceDatetime;
  196. /**
  197. * @var string
  198. */
  199. #[ORM\Column(name: 'apple_uid', type: 'string', length: 100, nullable: true)]
  200. protected $appleUid;
  201. /**
  202. * @var string
  203. */
  204. #[ORM\Column(name: 'braintree_customer', type: 'string', length: 255, nullable: true)]
  205. protected $braintreeCustomer;
  206. /**
  207. * @var string
  208. */
  209. #[ORM\Column(name: 'stripe_customer', type: 'string', length: 255, nullable: true)]
  210. protected $stripeCustomer;
  211. /**
  212. * @var int
  213. */
  214. #[ORM\Column(name: 'review_rating', type: 'decimal', precision: 7, scale: 2, nullable: false, options: ['default' => 5])]
  215. protected $reviewRating;
  216. #[ORM\OneToMany(targetEntity: \Booking::class, mappedBy: 'clientUser')]
  217. private $clientBookings;
  218. public function __construct()
  219. {
  220. $this->reviewRating = 5;
  221. $this->apiKey = str_replace('-', '', Uuid::uuid4());
  222. }
  223. /**
  224. * Get id
  225. *
  226. * @return int $id
  227. */
  228. public function getId()
  229. {
  230. return $this->id;
  231. }
  232. /**
  233. * @return Account
  234. */
  235. public function getAccount()
  236. {
  237. return $this->account;
  238. }
  239. /**
  240. * @param Account $account
  241. * @return User
  242. */
  243. public function setAccount(Account $account)
  244. {
  245. $this->account = $account;
  246. return $this;
  247. }
  248. /**
  249. * @return Company
  250. */
  251. public function getCompany()
  252. {
  253. return $this->company;
  254. }
  255. /**
  256. * @param Company $company
  257. * @return User
  258. */
  259. public function setCompany(Company $company)
  260. {
  261. $this->company = $company;
  262. return $this;
  263. }
  264. /**
  265. * @return Driver
  266. */
  267. public function getDriver()
  268. {
  269. return $this->driver;
  270. }
  271. /**
  272. * @param Driver $driver
  273. * @return User
  274. */
  275. public function setDriver(Driver $driver): User
  276. {
  277. $this->driver = $driver;
  278. return $this;
  279. }
  280. /**
  281. * @return string
  282. */
  283. public function getApiKey()
  284. {
  285. return $this->apiKey;
  286. }
  287. /**
  288. * @param string $apiKey
  289. */
  290. public function setApiKey($apiKey)
  291. {
  292. $this->apiKey = $apiKey;
  293. }
  294. public function toArray()
  295. {
  296. return get_object_vars($this);
  297. }
  298. public function getFullname() {
  299. return $this->getFirstname().' '.$this->getLastname();
  300. }
  301. public function __toString()
  302. {
  303. $string = $this->getFullname();
  304. if ($this->getPhone()) {
  305. $string .= ' - ' . $this->getPhone();
  306. }
  307. $string .= ' - ' . $this->getEmail();
  308. return $string;
  309. }
  310. /**
  311. * Add changeRequest
  312. *
  313. * @param \AdminBundle\Entity\ChangeRequests $changeRequest
  314. *
  315. * @return User
  316. */
  317. public function addChangeRequest(\AdminBundle\Entity\ChangeRequests $changeRequest)
  318. {
  319. $this->changeRequests[] = $changeRequest;
  320. return $this;
  321. }
  322. /**
  323. * Remove changeRequest
  324. *
  325. * @param \AdminBundle\Entity\ChangeRequests $changeRequest
  326. */
  327. public function removeChangeRequest(\AdminBundle\Entity\ChangeRequests $changeRequest)
  328. {
  329. $this->changeRequests->removeElement($changeRequest);
  330. }
  331. /**
  332. * Get changeRequests
  333. *
  334. * @return \Doctrine\Common\Collections\Collection
  335. */
  336. public function getChangeRequests()
  337. {
  338. return $this->changeRequests;
  339. }
  340. /**
  341. * Add clientChangeRequest
  342. *
  343. * @param \AdminBundle\Entity\ClientChangeRequest $clientChangeRequests
  344. *
  345. * @return User
  346. */
  347. public function addClientChangeRequest(\AdminBundle\Entity\ClientChangeRequest $clientChangeRequest)
  348. {
  349. $this->clientChangeRequests[] = $clientChangeRequest;
  350. return $this;
  351. }
  352. /**
  353. * Remove clientChangeRequest
  354. *
  355. * @param \AdminBundle\Entity\ClientChangeRequests $clientChangeRequest
  356. */
  357. public function removeClientChangeRequest(\AdminBundle\Entity\ClientChangeRequest $clientChangeRequest)
  358. {
  359. $this->clientChangeRequests->removeElement($clientChangeRequest);
  360. }
  361. /**
  362. * Get clientChangeRequest
  363. *
  364. * @return \Doctrine\Common\Collections\Collection
  365. */
  366. public function getClientChangeRequests()
  367. {
  368. return $this->clientChangeRequest;
  369. }
  370. /**
  371. * @return string
  372. */
  373. public function getAllowIpsToLogin()
  374. {
  375. return $this->allowIpsToLogin;
  376. }
  377. /**
  378. * @param string $allowIpsToLogin
  379. */
  380. public function setAllowIpsToLogin($allowIpsToLogin)
  381. {
  382. $this->allowIpsToLogin = $allowIpsToLogin;
  383. }
  384. public function getDeviceUid()
  385. {
  386. return $this->deviceUid;
  387. }
  388. public function getDeviceXid()
  389. {
  390. return $this->deviceXid;
  391. }
  392. public function getDeviceApplicationName()
  393. {
  394. return $this->deviceApplicationName;
  395. }
  396. public function getDeviceApplicationVersion()
  397. {
  398. return $this->deviceApplicationVersion;
  399. }
  400. public function getDeviceModel()
  401. {
  402. return $this->deviceModel;
  403. }
  404. public function getDeviceProduct()
  405. {
  406. return $this->deviceProduct;
  407. }
  408. public function getDeviceType()
  409. {
  410. return $this->deviceType;
  411. }
  412. public function getDeviceVendor()
  413. {
  414. return $this->deviceVendor;
  415. }
  416. public function getDeviceOsApiVersion()
  417. {
  418. return $this->deviceOsApiVersion;
  419. }
  420. public function getDeviceOsType()
  421. {
  422. return $this->deviceOsType;
  423. }
  424. public function getDeviceOsVersion()
  425. {
  426. return $this->deviceOsVersion;
  427. }
  428. public function getDeviceSandbox()
  429. {
  430. return $this->deviceSandbox;
  431. }
  432. public function getDeviceScreenDensity()
  433. {
  434. return $this->deviceScreenDensity;
  435. }
  436. public function getDeviceScreenHeight()
  437. {
  438. return $this->deviceScreenHeight;
  439. }
  440. public function getDeviceScreenOrientation()
  441. {
  442. return $this->deviceScreenOrientation;
  443. }
  444. public function getDeviceScreenWidth()
  445. {
  446. return $this->deviceScreenWidth;
  447. }
  448. public function getDeviceTimeZone()
  449. {
  450. return $this->deviceTimeZone;
  451. }
  452. public function getDeviceDatetime()
  453. {
  454. return $this->deviceDatetime;
  455. }
  456. public function setDeviceUid($deviceUid)
  457. {
  458. $this->deviceUid = $deviceUid;
  459. }
  460. public function setDeviceXid($deviceXid)
  461. {
  462. $this->deviceXid = $deviceXid;
  463. }
  464. public function setDeviceApplicationName($deviceApplicationName)
  465. {
  466. $this->deviceApplicationName = $deviceApplicationName;
  467. }
  468. public function setDeviceApplicationVersion($deviceApplicationVersion)
  469. {
  470. $this->deviceApplicationVersion = $deviceApplicationVersion;
  471. }
  472. public function setDeviceModel($deviceModel)
  473. {
  474. $this->deviceModel = $deviceModel;
  475. }
  476. public function setDeviceProduct($deviceProduct)
  477. {
  478. $this->deviceProduct = $deviceProduct;
  479. }
  480. public function setDeviceType($deviceType)
  481. {
  482. $this->deviceType = $deviceType;
  483. }
  484. public function setDeviceVendor($deviceVendor)
  485. {
  486. $this->deviceVendor = $deviceVendor;
  487. }
  488. public function setDeviceOsApiVersion($deviceOsApiVersion)
  489. {
  490. $this->deviceOsApiVersion = $deviceOsApiVersion;
  491. }
  492. public function setDeviceOsType($deviceOsType)
  493. {
  494. $this->deviceOsType = $deviceOsType;
  495. }
  496. public function setDeviceOsVersion($deviceOsVersion)
  497. {
  498. $this->deviceOsVersion = $deviceOsVersion;
  499. }
  500. public function setDeviceSandbox($device_sandbox)
  501. {
  502. $this->deviceSandbox = $device_sandbox;
  503. }
  504. public function setDeviceScreenDensity($device_screen_density)
  505. {
  506. $this->deviceScreenDensity = $device_screen_density;
  507. }
  508. public function setDeviceScreenHeight($deviceScreenHeight)
  509. {
  510. $this->deviceScreenHeight = $deviceScreenHeight;
  511. }
  512. public function setDeviceScreenOrientation($deviceScreenOrientation)
  513. {
  514. $this->deviceScreenOrientation = $deviceScreenOrientation;
  515. }
  516. public function setDeviceScreenWidth($deviceScreenWidth)
  517. {
  518. $this->deviceScreenWidth = $deviceScreenWidth;
  519. }
  520. public function setDeviceTimeZone($deviceTimeZone)
  521. {
  522. $this->deviceTimeZone = $deviceTimeZone;
  523. }
  524. public function setDeviceDatetime($deviceDatetime)
  525. {
  526. $this->deviceDatetime = $deviceDatetime;
  527. }
  528. /**
  529. * @return string
  530. */
  531. public function getAppleUid(): string
  532. {
  533. return $this->appleUid;
  534. }
  535. /**
  536. * @param string $appleUid
  537. */
  538. public function setAppleUid(string $appleUid)
  539. {
  540. $this->appleUid = $appleUid;
  541. }
  542. /**
  543. * @return int
  544. */
  545. public function getReviewRating()
  546. {
  547. return $this->reviewRating;
  548. }
  549. /**
  550. * @param float $reviewRating
  551. *
  552. * @return User
  553. */
  554. public function setReviewRating($reviewRating)
  555. {
  556. $this->reviewRating = $reviewRating;
  557. return $this;
  558. }
  559. /**
  560. * @return string
  561. */
  562. public function getBraintreeCustomer()
  563. {
  564. return $this->braintreeCustomer;
  565. }
  566. /**
  567. * @param string $braintreeCustomer
  568. */
  569. public function setBraintreeCustomer($braintreeCustomer)
  570. {
  571. $this->braintreeCustomer = $braintreeCustomer;
  572. }
  573. /**
  574. * @return string
  575. */
  576. public function getStripeCustomer()
  577. {
  578. return $this->stripeCustomer;
  579. }
  580. /**
  581. * @param string $stripeCustomer
  582. */
  583. public function setStripeCustomer($stripeCustomer)
  584. {
  585. $this->stripeCustomer = $stripeCustomer;
  586. }
  587. /**
  588. * @return ArrayCollection
  589. */
  590. public function getClientBookings()
  591. {
  592. return $this->clientBookings;
  593. }
  594. /**
  595. * @param Booking $bookings
  596. */
  597. public function setBookings(ArrayCollection $clientBookings)
  598. {
  599. $this->clientBookings = $clientBookings;
  600. return $this;
  601. }
  602. /**
  603. * Get userHistory
  604. *
  605. * @return Array
  606. */
  607. public static function getUserHistory()
  608. {
  609. return [];
  610. }
  611. /**
  612. * Old FosUser columns - methods -- start
  613. */
  614. public function setTwoStepVerificationCode($twoStepVerificationCode) {
  615. $this->twoStepVerificationCode = $twoStepVerificationCode;
  616. return $this;
  617. }
  618. public function getTwoStepVerificationCode() {
  619. return $this->twoStepVerificationCode;
  620. }
  621. public function setBiography($biography) {
  622. $this->biography = $biography;
  623. return $this;
  624. }
  625. public function getBiography() {
  626. return $this->biography;
  627. }
  628. public function setDateOfBirth($dateOfBirth) {
  629. $this->dateOfBirth = $dateOfBirth;
  630. return $this;
  631. }
  632. public function getDateOfBirth() {
  633. return $this->dateOfBirth;
  634. }
  635. public function setFacebookData($facebookData) {
  636. $this->facebookData = $facebookData;
  637. return $this;
  638. }
  639. public function getFacebookData() {
  640. return $this->facebookData;
  641. }
  642. public function setFacebookName($facebookName) {
  643. $this->facebookName = $facebookName;
  644. return $this;
  645. }
  646. public function getFacebookName() {
  647. return $this->facebookName;
  648. }
  649. public function setFacebookUid($facebookUid) {
  650. $this->facebookUid = $facebookUid;
  651. return $this;
  652. }
  653. public function getFacebookUid() {
  654. return $this->facebookUid;
  655. }
  656. public function setFirstname($firstname) {
  657. $this->firstname = $firstname;
  658. return $this;
  659. }
  660. public function getFirstname() {
  661. return $this->firstname;
  662. }
  663. public function setGender($gender) {
  664. $this->gender = $gender;
  665. return $this;
  666. }
  667. public function getGender() {
  668. return $this->gender;
  669. }
  670. public function setGplusData($gplusData) {
  671. $this->gplusData = $gplusData;
  672. return $this;
  673. }
  674. public function getGplusData() {
  675. return $this->gplusData;
  676. }
  677. public function setGplusName($gplusName) {
  678. $this->gplusName = $gplusName;
  679. return $this;
  680. }
  681. public function getGplusName() {
  682. return $this->gplusName;
  683. }
  684. public function setGplusUid($gplusUid) {
  685. $this->gplusUid = $gplusUid;
  686. return $this;
  687. }
  688. public function getGplusUid() {
  689. return $this->gplusUid;
  690. }
  691. public function setLastname($lastname) {
  692. $this->lastname = $lastname;
  693. return $this;
  694. }
  695. public function getLastname() {
  696. return $this->lastname;
  697. }
  698. public function setLocale($locale) {
  699. $this->locale = $locale;
  700. return $this;
  701. }
  702. public function getLocale() {
  703. return $this->locale;
  704. }
  705. public function setPhone($phone) {
  706. $this->phone = $phone;
  707. return $this;
  708. }
  709. public function getPhone() {
  710. return $this->phone;
  711. }
  712. public function setTimezone($timezone) {
  713. $this->timezone = $timezone;
  714. return $this;
  715. }
  716. public function getTimezone() {
  717. return $this->timezone;
  718. }
  719. public function setTwitterData($twitterData) {
  720. $this->twitterData = $twitterData;
  721. return $this;
  722. }
  723. public function getTwitterData() {
  724. return $this->twitterData;
  725. }
  726. public function setTwitterName($twitterName) {
  727. $this->twitterName = $twitterName;
  728. return $this;
  729. }
  730. public function getTwitterName() {
  731. return $this->twitterName;
  732. }
  733. public function setTwitterUid($twitterUid) {
  734. $this->twitterUid = $twitterUid;
  735. return $this;
  736. }
  737. public function getTwitterUid() {
  738. return $this->twitterUid;
  739. }
  740. public function setWebsite($website) {
  741. $this->website = $website;
  742. return $this;
  743. }
  744. public function getWebsite() {
  745. return $this->website;
  746. }
  747. public function setToken($token) {
  748. $this->token = $token;
  749. return $this;
  750. }
  751. public function getToken() {
  752. return $this->token;
  753. }
  754. /**
  755. * Old FosUser columns - methods -- end
  756. */
  757. }