src/Entity/Partner.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\Collection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use function PHPUnit\Framework\isEmpty;
  7. /**
  8. * Partner
  9. *
  10. * @ORM\Table(name="partner", indexes={@ORM\Index(name="partner_tuesday_slot_fk", columns={"tuesday"}), @ORM\Index(name="partner_saturay_slot_fk", columns={"saturday"}), @ORM\Index(name="partner_friday_slot_fk", columns={"friday"}), @ORM\Index(name="partner_wednesday_slot_fk", columns={"wednesday"}), @ORM\Index(name="partner_sunday_slot_fk", columns={"sunday"}), @ORM\Index(name="partner_monday_slot_fk", columns={"monday"}), @ORM\Index(name="partner_thursday_slot_fk", columns={"thursday"}), @ORM\Index(name="partner_partner_page_id_fk", columns={"partner_page_id"})})
  11. * @ORM\Entity(repositoryClass="App\Repository\PartnerRepository")
  12. */
  13. class Partner
  14. {
  15. /**
  16. * @var int|null
  17. *
  18. * @ORM\Column(name="id", type="integer", nullable=false)
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="IDENTITY")
  21. */
  22. private $id;
  23. /**
  24. * @var string|null
  25. *
  26. * @ORM\Column(name="last_name", type="string", length=255, nullable=true, options={"default"="NULL"})
  27. */
  28. private $lastName;
  29. /**
  30. * @var string|null
  31. *
  32. * @ORM\Column(name="first_name", type="string", length=255, nullable=true, options={"default"="NULL"})
  33. */
  34. private $firstName;
  35. /**
  36. * @var string|null
  37. *
  38. * @ORM\Column(name="public_email", type="string", length=255, nullable=true, options={"default"="NULL"})
  39. */
  40. private $publicEmail;
  41. /**
  42. * @var string|null
  43. *
  44. * @ORM\Column(name="phone", type="string", length=100, nullable=true, options={"default"="NULL"})
  45. */
  46. private $phone;
  47. /**
  48. * @var string|null
  49. *
  50. * @ORM\Column(name="avatar", type="string", length=255, nullable=true, options={"default"="NULL"})
  51. */
  52. private $avatar;
  53. /**
  54. * @var string|null
  55. *
  56. * @ORM\Column(name="slogan", type="string", length=255, nullable=true, options={"default"="NULL"})
  57. */
  58. private $slogan;
  59. /**
  60. * @var string|null
  61. *
  62. * @ORM\Column(name="address_name", type="string", length=255, nullable=true, options={"default"="NULL"})
  63. */
  64. private $addressName;
  65. /**
  66. * @var string|null
  67. *
  68. * @ORM\Column(name="address", type="string", length=255, nullable=true, options={"default"="NULL"})
  69. */
  70. private $address;
  71. /**
  72. * @var string|null
  73. *
  74. * @ORM\Column(name="address2", type="string", length=255, nullable=true, options={"default"="NULL"})
  75. */
  76. private $address2;
  77. /**
  78. * @var string|null
  79. *
  80. * @ORM\Column(name="zip_code", type="string", length=10, nullable=true, options={"default"="NULL"})
  81. */
  82. private $zipCode;
  83. /**
  84. * @var string|null
  85. *
  86. * @ORM\Column(name="city", type="string", length=100, nullable=true, options={"default"="NULL"})
  87. */
  88. private $city;
  89. /**
  90. * @var string|null
  91. *
  92. * @ORM\Column(name="country", type="string", length=100, nullable=true, options={"default"="NULL"})
  93. */
  94. private $country;
  95. /**
  96. * @var string|null
  97. *
  98. * @ORM\Column(name="address_coord_y", type="string", length=30, nullable=true, options={"default"="NULL"})
  99. */
  100. private $addressCoordY;
  101. /**
  102. * @var string|null
  103. *
  104. * @ORM\Column(name="address_coord_x", type="string", length=30, nullable=true, options={"default"="NULL"})
  105. */
  106. private $addressCoordX;
  107. /**
  108. * @var string|null
  109. *
  110. * @ORM\Column(name="siret", type="string", length=30, nullable=true, options={"default"="NULL"})
  111. */
  112. private $siret;
  113. /**
  114. * @var string|null
  115. *
  116. * @ORM\Column(name="legal_form", type="string", length=100, nullable=true, options={"default"="NULL"})
  117. */
  118. private $legalForm;
  119. /**
  120. * @var string|null
  121. *
  122. * @ORM\Column(name="assurance_name", type="string", length=255, nullable=true, options={"default"="NULL"})
  123. */
  124. private $assuranceName;
  125. /**
  126. * @var bool|null
  127. *
  128. * @ORM\Column(name="isCoach", type="boolean", nullable=true, options={"default"="NULL"})
  129. */
  130. private $iscoach;
  131. /**
  132. * @var bool|null
  133. *
  134. * @ORM\Column(name="isPractitioner", type="boolean", nullable=true, options={"default"="NULL"})
  135. */
  136. private $ispractitioner;
  137. /**
  138. * @var bool|null
  139. *
  140. * @ORM\Column(name="allow_teleconsultation", type="boolean", nullable=true, options={"default"="1"})
  141. */
  142. private $allowTeleconsultation = true;
  143. /**
  144. * @var bool|null
  145. *
  146. * @ORM\Column(name="allow_office", type="boolean", nullable=true, options={"default"="1"})
  147. */
  148. private $allowOffice = true;
  149. /**
  150. * @var bool|null
  151. *
  152. * @ORM\Column(name="allow_home_visit", type="boolean", nullable=true)
  153. */
  154. private $allowHomeVisit = false;
  155. /**
  156. * @var int|null
  157. *
  158. * @ORM\Column(name="nb_days_before_reservation", type="integer", nullable=true, options={"default"="1"})
  159. */
  160. private $nbDaysBeforeReservation = 1;
  161. /**
  162. * @var int|null
  163. *
  164. * @ORM\Column(name="nb_days_available", type="integer", nullable=true, options={"default"="60"})
  165. */
  166. private $nbDaysAvailable = 60;
  167. /**
  168. * @var DaySlot|null
  169. *
  170. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  171. * @ORM\JoinColumns({
  172. * @ORM\JoinColumn(name="monday", referencedColumnName="id")
  173. * })
  174. */
  175. private $monday;
  176. /**
  177. * @var DaySlot|null
  178. *
  179. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  180. * @ORM\JoinColumns({
  181. * @ORM\JoinColumn(name="sunday", referencedColumnName="id")
  182. * })
  183. */
  184. private $sunday;
  185. /**
  186. * @var DaySlot|null
  187. *
  188. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  189. * @ORM\JoinColumns({
  190. * @ORM\JoinColumn(name="wednesday", referencedColumnName="id")
  191. * })
  192. */
  193. private $wednesday;
  194. /**
  195. * @var PartnerPage|null
  196. *
  197. * @ORM\ManyToOne(targetEntity="PartnerPage")
  198. * @ORM\JoinColumns({
  199. * @ORM\JoinColumn(name="partner_page_id", referencedColumnName="id")
  200. * })
  201. */
  202. private $partnerPage;
  203. /**
  204. * @var DaySlot|null
  205. *
  206. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  207. * @ORM\JoinColumns({
  208. * @ORM\JoinColumn(name="thursday", referencedColumnName="id")
  209. * })
  210. */
  211. private $thursday;
  212. /**
  213. * @var DaySlot|null
  214. *
  215. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  216. * @ORM\JoinColumns({
  217. * @ORM\JoinColumn(name="friday", referencedColumnName="id")
  218. * })
  219. */
  220. private $friday;
  221. /**
  222. * @var DaySlot|null
  223. *
  224. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  225. * @ORM\JoinColumns({
  226. * @ORM\JoinColumn(name="saturday", referencedColumnName="id")
  227. * })
  228. */
  229. private $saturday;
  230. /**
  231. * @var DaySlot|null
  232. *
  233. * @ORM\ManyToOne(targetEntity="DaySlot",cascade={"persist"})
  234. * @ORM\JoinColumns({
  235. * @ORM\JoinColumn(name="tuesday", referencedColumnName="id")
  236. * })
  237. */
  238. private $tuesday;
  239. /**
  240. * @var Collection
  241. *
  242. * @ORM\ManyToMany(targetEntity="Speciality", inversedBy="partner")
  243. * @ORM\JoinTable(name="partner_has_speciality",
  244. * joinColumns={
  245. * @ORM\JoinColumn(name="partner_id", referencedColumnName="id")
  246. * },
  247. * inverseJoinColumns={
  248. * @ORM\JoinColumn(name="speciality_id", referencedColumnName="id")
  249. * }
  250. * )
  251. */
  252. private $speciality = array();
  253. /**
  254. * @var Collection
  255. *
  256. * @ORM\ManyToMany(targetEntity="Need", inversedBy="partner")
  257. * @ORM\JoinTable(name="partner_has_need",
  258. * joinColumns={
  259. * @ORM\JoinColumn(name="partner_id", referencedColumnName="id")
  260. * },
  261. * inverseJoinColumns={
  262. * @ORM\JoinColumn(name="need_id", referencedColumnName="id")
  263. * }
  264. * )
  265. */
  266. private $need = array();
  267. /**
  268. * @var Collection
  269. *
  270. * @ORM\OneToMany(targetEntity="PartnerHasUser", mappedBy="partner")
  271. */
  272. private $partnerHasUsers = array();
  273. /**
  274. * @var Account|null
  275. *
  276. * @ORM\OneToOne(targetEntity="Account", mappedBy="partner")
  277. */
  278. private $account;
  279. /**
  280. * @var Collection
  281. *
  282. * @ORM\OneToMany(targetEntity="ServiceDelivery", mappedBy="partner")
  283. */
  284. private $servicesDeliveries = array();
  285. /**
  286. * @var Collection
  287. *
  288. * @ORM\OneToMany(targetEntity="PartnerSubscription", mappedBy="partner")
  289. */
  290. private $subscriptions = array();
  291. /**
  292. * @var string|null
  293. *
  294. * @ORM\Column(name="stripe_account_id", type="string", length=100, nullable=true)
  295. */
  296. private $stripeAccountId;
  297. /**
  298. * @var bool
  299. *
  300. * @ORM\Column(name="stripe_account_verified", type="boolean", nullable=false)
  301. */
  302. private $stripeAccountVerified = false;
  303. /**
  304. * @var bool
  305. *
  306. * @ORM\Column(name="stripe_charges_enabled", type="boolean", nullable=false)
  307. */
  308. private $stripeChargesEnabled = false;
  309. /**
  310. * @var bool
  311. *
  312. * @ORM\Column(name="stripe_payouts_enabled", type="boolean", nullable=false)
  313. */
  314. private $stripePayoutsEnabled = false;
  315. /**
  316. * @var float|null
  317. *
  318. * @ORM\Column(name="subscription_discount", type="float", nullable=true)
  319. */
  320. private $subscriptionDiscount;
  321. /**
  322. * @var string|null
  323. *
  324. * @ORM\Column(name="subscription_discount_type", type="string", length=20, nullable=true)
  325. */
  326. private $subscriptionDiscountType;
  327. /**
  328. * @var int|null
  329. *
  330. * @ORM\Column(name="subscription_discount_duration", type="integer", nullable=true)
  331. */
  332. private $subscriptionDiscountDuration;
  333. /**
  334. * @var bool
  335. *
  336. * @ORM\Column(name="validated_practitioner", type="boolean", nullable=false)
  337. */
  338. private $validatedPractitioner = false;
  339. /**
  340. * @var bool
  341. *
  342. * @ORM\Column(name="validated_coach", type="boolean", nullable=false)
  343. */
  344. private $validatedCoach = false;
  345. /**
  346. * @var string|null
  347. * @Gedmo\Slug(fields={"lastName","firstName"}, updatable=true)
  348. * @ORM\Column(name="slug", type="string", length=255, nullable=true)
  349. */
  350. private $slug;
  351. /**
  352. * @var Collection
  353. *
  354. * @ORM\OneToMany(targetEntity="PartnerNote", mappedBy="partner")
  355. */
  356. private $notes;
  357. /**
  358. * @var string|null
  359. *
  360. * @ORM\Column(name="google_calendar_status", type="string", length=30, nullable=true)
  361. */
  362. private $googleCalendarStatus;
  363. /**
  364. * @var Collection
  365. *
  366. * @ORM\OneToMany(targetEntity="PartnerIcal", mappedBy="partner")
  367. */
  368. private $icals = array();
  369. /**
  370. * @var Collection
  371. *
  372. * @ORM\OneToMany(targetEntity="PartnerSecondaryLocation", mappedBy="partner", cascade={"persist"})
  373. */
  374. private $secondaryLocations = array();
  375. /**
  376. * @var string|null
  377. *
  378. * @ORM\Column(name="partnership_code", type="string", length=255, nullable=true, options={"default"="NULL"})
  379. */
  380. private $partnershipCode;
  381. /**
  382. * Constructor
  383. */
  384. public function __construct()
  385. {
  386. $this->speciality = new \Doctrine\Common\Collections\ArrayCollection();
  387. $this->need = new \Doctrine\Common\Collections\ArrayCollection();
  388. $this->partnerHasUsers = new \Doctrine\Common\Collections\ArrayCollection();
  389. $this->subscriptions = new \Doctrine\Common\Collections\ArrayCollection();
  390. $this->icals = new \Doctrine\Common\Collections\ArrayCollection();
  391. $this->secondaryLocations = new \Doctrine\Common\Collections\ArrayCollection();
  392. }
  393. /**
  394. * @return int|null
  395. */
  396. public function getId(): ?int
  397. {
  398. return $this->id;
  399. }
  400. /**
  401. * @param int $id
  402. */
  403. public function setId(int $id): void
  404. {
  405. $this->id = $id;
  406. }
  407. /**
  408. * @return string|null
  409. */
  410. public function getLastName(): ?string
  411. {
  412. return $this->lastName;
  413. }
  414. /**
  415. * @param string|null $lastName
  416. */
  417. public function setLastName(?string $lastName): void
  418. {
  419. $this->lastName = $lastName;
  420. }
  421. /**
  422. * @return string|null
  423. */
  424. public function getFirstName(): ?string
  425. {
  426. return $this->firstName;
  427. }
  428. /**
  429. * @param string|null $firstName
  430. */
  431. public function setFirstName(?string $firstName): void
  432. {
  433. $this->firstName = $firstName;
  434. }
  435. /**
  436. * @return string|null
  437. */
  438. public function getPublicEmail(): ?string
  439. {
  440. return $this->publicEmail;
  441. }
  442. /**
  443. * @param string|null $publicEmail
  444. */
  445. public function setPublicEmail(?string $publicEmail): void
  446. {
  447. $this->publicEmail = $publicEmail;
  448. }
  449. /**
  450. * @return string|null
  451. */
  452. public function getPhone(): ?string
  453. {
  454. return $this->phone;
  455. }
  456. /**
  457. * @param string|null $phone
  458. */
  459. public function setPhone(?string $phone): void
  460. {
  461. $this->phone = $phone;
  462. }
  463. /**
  464. * @return string|null
  465. */
  466. public function getAvatar(): ?string
  467. {
  468. return $this->avatar;
  469. }
  470. /**
  471. * @param string|null $avatar
  472. */
  473. public function setAvatar(?string $avatar): void
  474. {
  475. $this->avatar = $avatar;
  476. }
  477. /**
  478. * @return string|null
  479. */
  480. public function getSlogan(): ?string
  481. {
  482. return $this->slogan;
  483. }
  484. /**
  485. * @param string|null $slogan
  486. */
  487. public function setSlogan(?string $slogan): void
  488. {
  489. $this->slogan = $slogan;
  490. }
  491. /**
  492. * @return string|null
  493. */
  494. public function getAddressName(): ?string
  495. {
  496. return $this->addressName;
  497. }
  498. /**
  499. * @param string|null $addressName
  500. */
  501. public function setAddressName(?string $addressName): void
  502. {
  503. $this->addressName = $addressName;
  504. }
  505. /**
  506. * @return string|null
  507. */
  508. public function getAddress(): ?string
  509. {
  510. return $this->address;
  511. }
  512. /**
  513. * @param string|null $address
  514. */
  515. public function setAddress(?string $address): void
  516. {
  517. $this->address = $address;
  518. }
  519. /**
  520. * @return string|null
  521. */
  522. public function getAddress2(): ?string
  523. {
  524. return $this->address2;
  525. }
  526. /**
  527. * @param string|null $address2
  528. */
  529. public function setAddress2(?string $address2): void
  530. {
  531. $this->address2 = $address2;
  532. }
  533. /**
  534. * @return string|null
  535. */
  536. public function getZipCode(): ?string
  537. {
  538. return $this->zipCode;
  539. }
  540. /**
  541. * @param string|null $zipCode
  542. */
  543. public function setZipCode(?string $zipCode): void
  544. {
  545. $this->zipCode = $zipCode;
  546. }
  547. /**
  548. * @return string|null
  549. */
  550. public function getCity(): ?string
  551. {
  552. return $this->city;
  553. }
  554. /**
  555. * @param string|null $city
  556. */
  557. public function setCity(?string $city): void
  558. {
  559. $this->city = $city;
  560. }
  561. /**
  562. * @return string|null
  563. */
  564. public function getCountry(): ?string
  565. {
  566. return $this->country;
  567. }
  568. /**
  569. * @param string|null $country
  570. */
  571. public function setCountry(?string $country): void
  572. {
  573. $this->country = $country;
  574. }
  575. /**
  576. * @return string|null
  577. */
  578. public function getAddressCoordY(): ?string
  579. {
  580. return $this->addressCoordY;
  581. }
  582. /**
  583. * @param string|null $addressCoordY
  584. */
  585. public function setAddressCoordY(?string $addressCoordY): void
  586. {
  587. $this->addressCoordY = $addressCoordY;
  588. }
  589. /**
  590. * @return string|null
  591. */
  592. public function getAddressCoordX(): ?string
  593. {
  594. return $this->addressCoordX;
  595. }
  596. /**
  597. * @param string|null $addressCoordX
  598. */
  599. public function setAddressCoordX(?string $addressCoordX): void
  600. {
  601. $this->addressCoordX = $addressCoordX;
  602. }
  603. /**
  604. * @return string|null
  605. */
  606. public function getSiret(): ?string
  607. {
  608. return $this->siret;
  609. }
  610. /**
  611. * @param string|null $siret
  612. */
  613. public function setSiret(?string $siret): void
  614. {
  615. $this->siret = $siret;
  616. }
  617. /**
  618. * @return string|null
  619. */
  620. public function getLegalForm(): ?string
  621. {
  622. return $this->legalForm;
  623. }
  624. /**
  625. * @param string|null $legalForm
  626. */
  627. public function setLegalForm(?string $legalForm): void
  628. {
  629. $this->legalForm = $legalForm;
  630. }
  631. /**
  632. * @return string|null
  633. */
  634. public function getAssuranceName(): ?string
  635. {
  636. return $this->assuranceName;
  637. }
  638. /**
  639. * @param string|null $assuranceName
  640. */
  641. public function setAssuranceName(?string $assuranceName): void
  642. {
  643. $this->assuranceName = $assuranceName;
  644. }
  645. /**
  646. * @return bool|null
  647. */
  648. public function getIscoach(): ?bool
  649. {
  650. return $this->iscoach;
  651. }
  652. /**
  653. * @param bool|null $iscoach
  654. */
  655. public function setIscoach(?bool $iscoach): void
  656. {
  657. $this->iscoach = $iscoach;
  658. }
  659. /**
  660. * @return bool|null
  661. */
  662. public function getIspractitioner(): ?bool
  663. {
  664. return $this->ispractitioner;
  665. }
  666. /**
  667. * @param bool|null $ispractitioner
  668. */
  669. public function setIspractitioner(?bool $ispractitioner): void
  670. {
  671. $this->ispractitioner = $ispractitioner;
  672. }
  673. /**
  674. * @return bool|null
  675. */
  676. public function getAllowTeleconsultation(): ?bool
  677. {
  678. return $this->allowTeleconsultation;
  679. }
  680. /**
  681. * @param bool|null $allowTeleconsultation
  682. */
  683. public function setAllowTeleconsultation(?bool $allowTeleconsultation): void
  684. {
  685. $this->allowTeleconsultation = $allowTeleconsultation;
  686. }
  687. /**
  688. * @return bool|null
  689. */
  690. public function getAllowOffice(): ?bool
  691. {
  692. return $this->allowOffice;
  693. }
  694. /**
  695. * @param bool|null $allowOffice
  696. */
  697. public function setAllowOffice(?bool $allowOffice): void
  698. {
  699. $this->allowOffice = $allowOffice;
  700. }
  701. /**
  702. * @return bool|null
  703. */
  704. public function getAllowHomeVisit(): ?bool
  705. {
  706. return $this->allowHomeVisit;
  707. }
  708. /**
  709. * @param bool|null $allowHomeVisit
  710. */
  711. public function setAllowHomeVisit(?bool $allowHomeVisit): void
  712. {
  713. $this->allowHomeVisit = $allowHomeVisit;
  714. }
  715. /**
  716. * @return int|null
  717. */
  718. public function getNbDaysBeforeReservation(): ?int
  719. {
  720. return $this->nbDaysBeforeReservation;
  721. }
  722. /**
  723. * @param int|null $nbDaysBeforeReservation
  724. */
  725. public function setNbDaysBeforeReservation(?int $nbDaysBeforeReservation): void
  726. {
  727. $this->nbDaysBeforeReservation = $nbDaysBeforeReservation;
  728. }
  729. /**
  730. * @return int|null
  731. */
  732. public function getNbDaysAvailable(): ?int
  733. {
  734. return $this->nbDaysAvailable;
  735. }
  736. /**
  737. * @param int|null $nbDaysAvailable
  738. */
  739. public function setNbDaysAvailable(?int $nbDaysAvailable): void
  740. {
  741. $this->nbDaysAvailable = $nbDaysAvailable;
  742. }
  743. /**
  744. * @return DaySlot|null
  745. */
  746. public function getMonday(): ?DaySlot
  747. {
  748. return $this->monday;
  749. }
  750. /**
  751. * @param DaySlot|null $monday
  752. */
  753. public function setMonday(?DaySlot $monday): void
  754. {
  755. $this->monday = $monday;
  756. }
  757. /**
  758. * @return DaySlot|null
  759. */
  760. public function getSunday(): ?DaySlot
  761. {
  762. return $this->sunday;
  763. }
  764. /**
  765. * @param DaySlot|null $sunday
  766. */
  767. public function setSunday(?DaySlot $sunday): void
  768. {
  769. $this->sunday = $sunday;
  770. }
  771. /**
  772. * @return DaySlot|null
  773. */
  774. public function getWednesday(): ?DaySlot
  775. {
  776. return $this->wednesday;
  777. }
  778. /**
  779. * @param DaySlot|null $wednesday
  780. */
  781. public function setWednesday(?DaySlot $wednesday): void
  782. {
  783. $this->wednesday = $wednesday;
  784. }
  785. /**
  786. * @return PartnerPage|null
  787. */
  788. public function getPartnerPage(): ?PartnerPage
  789. {
  790. return $this->partnerPage;
  791. }
  792. /**
  793. * @param PartnerPage|null $partnerPage
  794. */
  795. public function setPartnerPage(?PartnerPage $partnerPage): void
  796. {
  797. $this->partnerPage = $partnerPage;
  798. }
  799. /**
  800. * @return DaySlot|null
  801. */
  802. public function getThursday(): ?DaySlot
  803. {
  804. return $this->thursday;
  805. }
  806. /**
  807. * @param DaySlot|null $thursday
  808. */
  809. public function setThursday(?DaySlot $thursday): void
  810. {
  811. $this->thursday = $thursday;
  812. }
  813. /**
  814. * @return DaySlot|null
  815. */
  816. public function getFriday(): ?DaySlot
  817. {
  818. return $this->friday;
  819. }
  820. /**
  821. * @param DaySlot|null $friday
  822. */
  823. public function setFriday(?DaySlot $friday): void
  824. {
  825. $this->friday = $friday;
  826. }
  827. /**
  828. * @return DaySlot|null
  829. */
  830. public function getSaturday(): ?DaySlot
  831. {
  832. return $this->saturday;
  833. }
  834. /**
  835. * @param DaySlot|null $saturday
  836. */
  837. public function setSaturday(?DaySlot $saturday): void
  838. {
  839. $this->saturday = $saturday;
  840. }
  841. /**
  842. * @return DaySlot|null
  843. */
  844. public function getTuesday(): ?DaySlot
  845. {
  846. return $this->tuesday;
  847. }
  848. /**
  849. * @param DaySlot|null $tuesday
  850. */
  851. public function setTuesday(?DaySlot $tuesday): void
  852. {
  853. $this->tuesday = $tuesday;
  854. }
  855. /**
  856. * @return Collection
  857. */
  858. public function getSpeciality()
  859. {
  860. return $this->speciality;
  861. }
  862. /**
  863. * @param Collection $speciality
  864. */
  865. public function setSpeciality($speciality): void
  866. {
  867. $this->speciality = $speciality;
  868. }
  869. /**
  870. * @return Collection
  871. */
  872. public function getNeed()
  873. {
  874. return $this->need;
  875. }
  876. /**
  877. * @param Collection $need
  878. */
  879. public function setNeed($need): void
  880. {
  881. $this->need = $need;
  882. }
  883. /**
  884. * @return Collection
  885. */
  886. public function getPartnerHasUsers()
  887. {
  888. return $this->partnerHasUsers;
  889. }
  890. /**
  891. * @param Collection $partnerHasUsers
  892. */
  893. public function setPartnerHasUsers($partnerHasUsers): void
  894. {
  895. $this->partnerHasUsers = $partnerHasUsers;
  896. }
  897. /**
  898. * @return Account|null
  899. */
  900. public function getAccount(): ?Account
  901. {
  902. return $this->account;
  903. }
  904. /**
  905. * @param Account|null $account
  906. */
  907. public function setAccount(?Account $account): void
  908. {
  909. $this->account = $account;
  910. }
  911. /**
  912. * @return Collection
  913. */
  914. public function getServicesDeliveries(): Collection
  915. {
  916. return $this->servicesDeliveries;
  917. }
  918. /**
  919. * @param Collection $servicesDeliveries
  920. */
  921. public function setServicesDeliveries(Collection $servicesDeliveries): void
  922. {
  923. $this->servicesDeliveries = $servicesDeliveries;
  924. }
  925. /**
  926. * @return Collection
  927. */
  928. public function getSubscriptions()
  929. {
  930. return $this->subscriptions;
  931. }
  932. /**
  933. * @param Collection $subscriptions
  934. */
  935. public function setSubscriptions($subscriptions): void
  936. {
  937. $this->subscriptions = $subscriptions;
  938. }
  939. /**
  940. * @return string|null
  941. */
  942. public function getStripeAccountId(): ?string
  943. {
  944. return $this->stripeAccountId;
  945. }
  946. /**
  947. * @param string|null $stripeAccountId
  948. */
  949. public function setStripeAccountId(?string $stripeAccountId): void
  950. {
  951. $this->stripeAccountId = $stripeAccountId;
  952. }
  953. /**
  954. * @return bool
  955. */
  956. public function isStripeAccountVerified(): bool
  957. {
  958. return $this->stripeAccountVerified;
  959. }
  960. /**
  961. * @param bool $stripeAccountVerified
  962. */
  963. public function setStripeAccountVerified(bool $stripeAccountVerified): void
  964. {
  965. $this->stripeAccountVerified = $stripeAccountVerified;
  966. }
  967. /**
  968. * @return bool
  969. */
  970. public function isStripeChargesEnabled(): bool
  971. {
  972. return $this->stripeChargesEnabled;
  973. }
  974. /**
  975. * @param bool $stripeChargesEnabled
  976. */
  977. public function setStripeChargesEnabled(bool $stripeChargesEnabled): void
  978. {
  979. $this->stripeChargesEnabled = $stripeChargesEnabled;
  980. }
  981. /**
  982. * @return bool
  983. */
  984. public function isStripePayoutsEnabled(): bool
  985. {
  986. return $this->stripePayoutsEnabled;
  987. }
  988. /**
  989. * @param bool $stripePayoutsEnabled
  990. */
  991. public function setStripePayoutsEnabled(bool $stripePayoutsEnabled): void
  992. {
  993. $this->stripePayoutsEnabled = $stripePayoutsEnabled;
  994. }
  995. /**
  996. * @return float|null
  997. */
  998. public function getSubscriptionDiscount()
  999. {
  1000. return $this->subscriptionDiscount;
  1001. }
  1002. /**
  1003. * @param float|null $subscriptionDiscount
  1004. */
  1005. public function setSubscriptionDiscount($subscriptionDiscount): void
  1006. {
  1007. $this->subscriptionDiscount = $subscriptionDiscount;
  1008. }
  1009. /**
  1010. * @return string|null
  1011. */
  1012. public function getSubscriptionDiscountType(): ?string
  1013. {
  1014. return $this->subscriptionDiscountType;
  1015. }
  1016. /**
  1017. * @param string|null $subscriptionDiscountType
  1018. */
  1019. public function setSubscriptionDiscountType(?string $subscriptionDiscountType): void
  1020. {
  1021. $this->subscriptionDiscountType = $subscriptionDiscountType;
  1022. }
  1023. /**
  1024. * @return int|null
  1025. */
  1026. public function getSubscriptionDiscountDuration(): ?int
  1027. {
  1028. return $this->subscriptionDiscountDuration;
  1029. }
  1030. /**
  1031. * @param int|null $subscriptionDiscountDuration
  1032. */
  1033. public function setSubscriptionDiscountDuration(?int $subscriptionDiscountDuration): void
  1034. {
  1035. $this->subscriptionDiscountDuration = $subscriptionDiscountDuration;
  1036. }
  1037. /**
  1038. * @return bool
  1039. */
  1040. public function isValidatedPractitioner(): bool
  1041. {
  1042. return $this->validatedPractitioner;
  1043. }
  1044. /**
  1045. * @param bool $validatedPractitioner
  1046. */
  1047. public function setValidatedPractitioner(bool $validatedPractitioner): void
  1048. {
  1049. $this->validatedPractitioner = $validatedPractitioner;
  1050. }
  1051. /**
  1052. * @return bool
  1053. */
  1054. public function isValidatedCoach(): bool
  1055. {
  1056. return $this->validatedCoach;
  1057. }
  1058. /**
  1059. * @param bool $validatedCoach
  1060. */
  1061. public function setValidatedCoach(bool $validatedCoach): void
  1062. {
  1063. $this->validatedCoach = $validatedCoach;
  1064. }
  1065. /**
  1066. * @return string|null
  1067. */
  1068. public function getSlug(): ?string
  1069. {
  1070. return $this->slug;
  1071. }
  1072. /**
  1073. * @param string|null $slug
  1074. */
  1075. public function setSlug(?string $slug): void
  1076. {
  1077. $this->slug = $slug;
  1078. }
  1079. /**
  1080. * @return Collection
  1081. */
  1082. public function getNotes(): Collection
  1083. {
  1084. return $this->notes;
  1085. }
  1086. /**
  1087. * @param Collection $notes
  1088. */
  1089. public function setNotes(Collection $notes): void
  1090. {
  1091. $this->notes = $notes;
  1092. }
  1093. /**
  1094. * @return string|null
  1095. */
  1096. public function getGoogleCalendarStatus(): ?string
  1097. {
  1098. return $this->googleCalendarStatus;
  1099. }
  1100. /**
  1101. * @param string|null $googleCalendarStatus
  1102. */
  1103. public function setGoogleCalendarStatus(?string $googleCalendarStatus): void
  1104. {
  1105. $this->googleCalendarStatus = $googleCalendarStatus;
  1106. }
  1107. /**
  1108. * @return Collection
  1109. */
  1110. public function getIcals()
  1111. {
  1112. return $this->icals;
  1113. }
  1114. /**
  1115. * @param Collection $icals
  1116. */
  1117. public function setIcals($icals): void
  1118. {
  1119. $this->icals = $icals;
  1120. }
  1121. /**
  1122. * @return Collection
  1123. */
  1124. public function getSecondaryLocations()
  1125. {
  1126. return $this->secondaryLocations;
  1127. }
  1128. /**
  1129. * @param Collection $secondaryLocations
  1130. */
  1131. public function setSecondaryLocations($secondaryLocations): void
  1132. {
  1133. $this->secondaryLocations = $secondaryLocations;
  1134. }
  1135. /**
  1136. * @return string|null
  1137. */
  1138. public function getPartnershipCode(): ?string
  1139. {
  1140. return $this->partnershipCode;
  1141. }
  1142. /**
  1143. * @param string|null $partnershipCode
  1144. */
  1145. public function setPartnershipCode(?string $partnershipCode): void
  1146. {
  1147. $this->partnershipCode = $partnershipCode;
  1148. }
  1149. public function getSpecialitiesString(): string
  1150. {
  1151. $specialities = [];
  1152. foreach ($this->getSpeciality() as $speciality) {
  1153. $specialities[] = $speciality->getLabel();
  1154. }
  1155. return implode(', ', $specialities);
  1156. }
  1157. public function getSpecialitiesJobString(): string
  1158. {
  1159. $specialities = [];
  1160. foreach ($this->getSpeciality() as $speciality) {
  1161. $specialities[] = $speciality->getJob();
  1162. }
  1163. return implode(', ', $specialities);
  1164. }
  1165. public function getLowestServiceDelivery(): ?ServiceDelivery
  1166. {
  1167. $serviceDelivery = null;
  1168. foreach ($this->getServicesDeliveries() as $sd) {
  1169. if ((!$serviceDelivery || $sd->getPrice() < $serviceDelivery->getPrice()) && $sd->getEnabled() && !$sd->getHistoryService() && !$sd->getIsCoaching()) {
  1170. $serviceDelivery = $sd;
  1171. }
  1172. }
  1173. return $serviceDelivery;
  1174. }
  1175. public function getAvailablesServicesDeliveries($onlyCoaching=false, $removeCoachings=false, $removeOnlyFirst=false, $removeOnlySecond=false): array
  1176. {
  1177. $servicesAvailables = [];
  1178. foreach ($this->getServicesDeliveries() as $servicesDelivery) {
  1179. if ($servicesDelivery->getEnabled() && !$servicesDelivery->getHistoryService()) {
  1180. $goAdd = true;
  1181. if ($onlyCoaching && !$servicesDelivery->getIsCoaching()) {
  1182. $goAdd = false;
  1183. }
  1184. if ($removeCoachings && $servicesDelivery->getIsCoaching()) {
  1185. $goAdd = false;
  1186. }
  1187. if ($removeOnlyFirst && $servicesDelivery->getFirstReservationOnly()) {
  1188. $goAdd = false;
  1189. }
  1190. if ($removeOnlySecond && $servicesDelivery->getSecondReservationOnly()) {
  1191. $goAdd = false;
  1192. }
  1193. if ($goAdd) {
  1194. $servicesAvailables[] = $servicesDelivery;
  1195. }
  1196. }
  1197. }
  1198. usort($servicesAvailables, function($a, $b) {return strcasecmp($a->getLabel(), $b->getLabel());});
  1199. return $servicesAvailables;
  1200. }
  1201. public function getCurrentSubscription(): ?PartnerSubscription
  1202. {
  1203. $now = new \DateTime('now');
  1204. foreach ($this::getSubscriptions() as $sub) {
  1205. if (!$sub->getEndDate() || $now < $sub->getEndDate()) {
  1206. return $sub;
  1207. }
  1208. }
  1209. return null;
  1210. }
  1211. public function getLatestSubscription()
  1212. {
  1213. return $this::getSubscriptions()->last();
  1214. }
  1215. /**
  1216. * @return bool
  1217. */
  1218. public function isSubscriptionActive(): bool
  1219. {
  1220. if ($this->getIspractitioner()) {
  1221. return (bool) $this::getCurrentSubscription();
  1222. }
  1223. return true;
  1224. }
  1225. public function getIsActiveCoach (): bool
  1226. {
  1227. if ($this->getAccount() && $this->getAccount()->getEnabled() == false) {
  1228. return false;
  1229. }
  1230. return $this->isValidatedCoach();
  1231. }
  1232. public function getIsActivePractitioner(): bool
  1233. {
  1234. if ($this->getAccount() && $this->getAccount()->getEnabled() == false) {
  1235. return false;
  1236. }
  1237. return (bool) $this::getCurrentSubscription() && $this->isStripeAccountVerified() && $this->isValidatedPractitioner();
  1238. }
  1239. public function getIsActive(): bool
  1240. {
  1241. if ($this->getIscoach() && !$this->getIsActiveCoach()) {
  1242. return false;
  1243. }
  1244. if ($this->getIspractitioner() && !$this->getIsActivePractitioner()) {
  1245. return false;
  1246. }
  1247. return true;
  1248. }
  1249. public function getNoteValue()
  1250. {
  1251. if ($this->getNotes()->isEmpty()) {
  1252. return 0.0;
  1253. }
  1254. $sum = 0.0;
  1255. foreach ($this->getNotes() as $note) {
  1256. $sum+=$note->getNote();
  1257. }
  1258. return $sum/$this->getNotes()->count();
  1259. }
  1260. public function getReviews(): array
  1261. {
  1262. $reviews = [];
  1263. foreach ($this->getNotes() as $note) {
  1264. if ($note->getOpinion() && !empty($note->getOpinion())) {
  1265. $reviews[] = $note;
  1266. }
  1267. }
  1268. return $reviews;
  1269. }
  1270. public function countReviews(): int
  1271. {
  1272. return count($this->getReviews());
  1273. }
  1274. public function addSecondaryLocation(PartnerSecondaryLocation $secondaryLocation)
  1275. {
  1276. if ($secondaryLocation->getAddress()) {
  1277. if (!$secondaryLocation->getName()) {
  1278. $secondaryLocation->setName($secondaryLocation->getAddress());
  1279. }
  1280. $this->secondaryLocations[] = $secondaryLocation;
  1281. $secondaryLocation->setPartner($this);
  1282. }
  1283. }
  1284. public function removeSecondaryLocation(PartnerSecondaryLocation $secondaryLocation)
  1285. {
  1286. $this->secondaryLocations->removeElement($secondaryLocation);
  1287. }
  1288. }