src/Entity/Enterprise.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Abstract\Entity;
  4. use App\Repository\EnterpriseRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Gedmo\Loggable\Loggable;
  9. use Symfony\Component\Uid\Uuid;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Gedmo\Mapping\Annotation as Gedmo;
  13. #[ORM\Entity(repositoryClass: EnterpriseRepository::class)]
  14. class Enterprise extends Entity
  15. {
  16. #[ORM\Id]
  17. #[ORM\Column(type: 'uuid', unique: true)]
  18. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  19. #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
  20. private ?Uuid $id = null;
  21. #[ORM\Column(length: 255)]
  22. #[Assert\NotBlank]
  23. private ?string $name = null;
  24. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Discount::class, cascade: ['persist', 'remove'])]
  25. private Collection $discounts;
  26. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Admin::class, cascade: ['persist', 'remove'])]
  27. private Collection $users;
  28. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Company::class)]
  29. private Collection $companies;
  30. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Employee::class, cascade: ['persist', 'remove'])]
  31. private Collection $employees;
  32. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: ProcessedPaymentPeriod::class, cascade: ['persist', 'remove'])]
  33. private Collection $processedPaymentPeriods;
  34. #[ORM\Column(length: 255)]
  35. #[Assert\NotBlank]
  36. private ?string $uidNumber = null;
  37. #[ORM\Column(length: 20)]
  38. #[Assert\NotBlank]
  39. private ?string $numberOfEmployees = null;
  40. /**
  41. * 0: Firma in Prüfung
  42. * 1: Firma aktiv in Beobachtung
  43. * 2: Firma aktiv
  44. * 3: Firma gesperrt
  45. *
  46. *
  47. * @var int|null
  48. */
  49. #[ORM\Column(nullable: true)]
  50. private ?int $status = null;
  51. #[ORM\ManyToOne(inversedBy: 'enterprises')]
  52. private ?Seller $seller = null;
  53. #[ORM\ManyToMany(targetEntity: Institution::class, mappedBy: 'participation')]
  54. private Collection $participations;
  55. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Contact::class, cascade: ['persist', 'remove'])]
  56. #[Assert\NotBlank]
  57. #[Assert\Valid]
  58. private Collection $contacts;
  59. #[Assert\NotBlank(message: 'persona.error.agb',groups: ['registration'])]
  60. private bool $agb = false;
  61. #[ORM\Column(nullable: true)]
  62. private ?bool $noVerification = null;
  63. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: CompanyDidok::class, cascade: ['persist', 'remove'])]
  64. #[Assert\Valid]
  65. private Collection $companyDidoks;
  66. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: Report::class, cascade: ['persist', 'remove'])]
  67. private Collection $reports;
  68. #[ORM\Column(nullable: true)]
  69. private ?bool $cashPurchaseOption = null;
  70. #[ORM\Column(nullable: true)]
  71. private ?bool $stackPurchaseOption = null;
  72. #[ORM\Column(nullable: true)]
  73. private ?bool $eSavOption = null;
  74. #[ORM\Column(length: 255, nullable: true)]
  75. private ?string $extendedParicipation = null;
  76. #[ORM\Column(nullable: true)]
  77. private ?bool $contractOption = null;
  78. #[ORM\Column(nullable: true)]
  79. private ?int $invitationLinkExpiresAt = null;
  80. #[ORM\Column(nullable: true)]
  81. private ?bool $verificationForNewEmployees = null;
  82. #[ORM\Column(nullable: true)]
  83. private ?bool $suppressPurchaseEmailsOption = null;
  84. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: RegistrationLink::class, cascade: ['persist', 'remove'])]
  85. private Collection $registrationLinks;
  86. #[ORM\Column(length: 255, nullable: true)]
  87. private ?string $locale = null;
  88. #[ORM\Column(nullable: true)]
  89. private ?bool $createSwissPassOption = null;
  90. #[ORM\Column(length: 10, nullable: true)]
  91. private ?string $district = null;
  92. #[ORM\Column(nullable: true)]
  93. private ?bool $remainingBalanceOption = null;
  94. #[ORM\Column(nullable: true)]
  95. private ?bool $remainingBalanceRenewalOption = null;
  96. #[ORM\Column(nullable: true)]
  97. private ?bool $documentUploadOption = null;
  98. #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  99. private ?\DateTimeInterface $remainingBalanceStartDate = null;
  100. #[ORM\Column(nullable: true)]
  101. private ?bool $startRemainingBalanceOnPurchase = null;
  102. #[ORM\Column(nullable: true)]
  103. private ?bool $reminderOption = null;
  104. #[ORM\ManyToOne(inversedBy: 'enterprises')]
  105. private ?Tu $tu = null;
  106. #[ORM\Column(length: 50, nullable: true)]
  107. private ?string $customerNumber = null;
  108. #[ORM\Column(length: 255, nullable: true)]
  109. private ?string $logoFilename = null;
  110. #[ORM\Column(length: 100, nullable: true)]
  111. private ?string $logoMimeType = null;
  112. #[ORM\ManyToMany(targetEntity: PricingModel::class)]
  113. private Collection $pricingModels;
  114. #[ORM\Column(nullable: true)]
  115. private ?bool $allZonesOption = null;
  116. #[ORM\OneToMany(mappedBy: 'enterprise', targetEntity: ModuleSubscription::class, cascade: ['persist', 'remove'])]
  117. private Collection $moduleSubscriptions;
  118. #[ORM\Column(nullable: true)]
  119. private ?array $countryRestriction = null;
  120. #[ORM\Column(nullable: true)]
  121. private ?int $supportedClass = null;
  122. #[ORM\Column(nullable: true)]
  123. private ?array $allowedProducts = null;
  124. #[ORM\ManyToOne(targetEntity: Admin::class)]
  125. private ?Admin $kam = null;
  126. public function __construct()
  127. {
  128. $this->discounts = new ArrayCollection();
  129. $this->users = new ArrayCollection();
  130. $this->companies = new ArrayCollection();
  131. $this->employees = new ArrayCollection();
  132. $this->participations = new ArrayCollection();
  133. $this->contacts = new ArrayCollection();
  134. $this->companyDidoks = new ArrayCollection();
  135. $this->reports = new ArrayCollection();
  136. $this->registrationLinks = new ArrayCollection();
  137. $this->pricingModels = new ArrayCollection();
  138. $this->processedPaymentPeriods = new ArrayCollection();
  139. $this->moduleSubscriptions = new ArrayCollection();
  140. }
  141. public function getId(): ?Uuid
  142. {
  143. return $this->id;
  144. }
  145. public function getKam(): ?Admin
  146. {
  147. return $this->kam;
  148. }
  149. public function setKam(?Admin $kam): self
  150. {
  151. $this->kam = $kam;
  152. return $this;
  153. }
  154. public function getName(): ?string
  155. {
  156. return $this->name;
  157. }
  158. public function setName(string $name): self
  159. {
  160. $this->name = $name;
  161. return $this;
  162. }
  163. /**
  164. * @return Collection<int, Discount>
  165. */
  166. public function getDiscounts(): Collection
  167. {
  168. return $this->discounts;
  169. }
  170. public function addDiscount(Discount $discount): self
  171. {
  172. if (!$this->discounts->contains($discount)) {
  173. $this->discounts->add($discount);
  174. $discount->setEnterprise($this);
  175. }
  176. return $this;
  177. }
  178. public function removeDiscount(Discount $discount): self
  179. {
  180. if ($this->discounts->removeElement($discount)) {
  181. // set the owning side to null (unless already changed)
  182. if ($discount->getEnterprise() === $this) {
  183. $discount->setEnterprise(null);
  184. }
  185. }
  186. return $this;
  187. }
  188. /**
  189. * @return Collection<int, User>
  190. */
  191. public function getUsers(): Collection
  192. {
  193. return $this->users;
  194. }
  195. public function addUser(User $user): self
  196. {
  197. if (!$this->users->contains($user)) {
  198. $this->users->add($user);
  199. $user->setEnterprise($this);
  200. }
  201. return $this;
  202. }
  203. public function removeUser(User $user): self
  204. {
  205. if ($this->users->removeElement($user)) {
  206. // set the owning side to null (unless already changed)
  207. if ($user->getEnterprise() === $this) {
  208. $user->setEnterprise(null);
  209. }
  210. }
  211. return $this;
  212. }
  213. /**
  214. * @return Collection<int, Company>
  215. */
  216. public function getCompanies(): Collection
  217. {
  218. return $this->companies;
  219. }
  220. public function addCompany(Company $company): self
  221. {
  222. if (!$this->companies->contains($company)) {
  223. $this->companies->add($company);
  224. $company->setEnterprise($this);
  225. }
  226. return $this;
  227. }
  228. public function removeCompany(Company $company): self
  229. {
  230. if ($this->companies->removeElement($company)) {
  231. // set the owning side to null (unless already changed)
  232. if ($company->getEnterprise() === $this) {
  233. $company->setEnterprise(null);
  234. }
  235. }
  236. return $this;
  237. }
  238. /**
  239. * @return Collection<int, Employee>
  240. */
  241. public function getEmployees(): Collection
  242. {
  243. return $this->employees;
  244. }
  245. public function addEmployee(Employee $employee): self
  246. {
  247. if (!$this->employees->contains($employee)) {
  248. $this->employees->add($employee);
  249. $employee->setEnterprise($this);
  250. }
  251. return $this;
  252. }
  253. public function removeEmployee(Employee $employee): self
  254. {
  255. if ($this->employees->removeElement($employee)) {
  256. // set the owning side to null (unless already changed)
  257. if ($employee->getEnterprise() === $this) {
  258. $employee->setEnterprise(null);
  259. }
  260. }
  261. return $this;
  262. }
  263. public function getUidNumber(): ?string
  264. {
  265. return $this->uidNumber;
  266. }
  267. public function setUidNumber(string $uidNumber): self
  268. {
  269. $this->uidNumber = $uidNumber;
  270. return $this;
  271. }
  272. public function getNumberOfEmployees(): ?string
  273. {
  274. return $this->numberOfEmployees;
  275. }
  276. public function setNumberOfEmployees(string $numberOfEmployees): self
  277. {
  278. $this->numberOfEmployees = $numberOfEmployees;
  279. return $this;
  280. }
  281. public function getStatus(): ?int
  282. {
  283. return $this->status;
  284. }
  285. public function setStatus(?int $status): self
  286. {
  287. $this->status = $status;
  288. return $this;
  289. }
  290. /**
  291. * @return bool
  292. */
  293. public function isActive(): bool
  294. {
  295. if($this->status == 1 || $this->status == 2){
  296. return true;
  297. } else {
  298. return false;
  299. }
  300. }
  301. public function getSeller(): ?Seller
  302. {
  303. return $this->seller;
  304. }
  305. public function setSeller(?Seller $seller): self
  306. {
  307. $this->seller = $seller;
  308. return $this;
  309. }
  310. /**
  311. * @return Collection<int, Institution>
  312. */
  313. public function getParticipations(): Collection
  314. {
  315. return $this->participations;
  316. }
  317. public function addParticipation(Institution $participation): self
  318. {
  319. if (!$this->participations->contains($participation)) {
  320. $this->participations->add($participation);
  321. $participation->addParticipation($this);
  322. }
  323. return $this;
  324. }
  325. public function removeParticipation(Institution $participation): self
  326. {
  327. if ($this->participations->removeElement($participation)) {
  328. $participation->removeParticipation($this);
  329. }
  330. return $this;
  331. }
  332. /**
  333. * @return Collection<int, Contact>
  334. */
  335. public function getContacts(): Collection
  336. {
  337. return $this->contacts;
  338. }
  339. public function addContact(Contact $contact): self
  340. {
  341. if (!$this->contacts->contains($contact)) {
  342. $this->contacts->add($contact);
  343. $contact->setEnterprise($this);
  344. }
  345. return $this;
  346. }
  347. public function removeContact(Contact $contact): self
  348. {
  349. if ($this->contacts->removeElement($contact)) {
  350. // set the owning side to null (unless already changed)
  351. if ($contact->getEnterprise() === $this) {
  352. $contact->setEnterprise(null);
  353. }
  354. }
  355. return $this;
  356. }
  357. /**
  358. * @param int $type
  359. * @return Contact|null
  360. */
  361. public function getFirstContactByType(int $type): ?Contact
  362. {
  363. if(!empty($this->contacts)){
  364. /** @var Contact $contact */
  365. foreach($this->contacts as $contact){
  366. if($contact->getType() == $type){
  367. return $contact;
  368. }
  369. }
  370. }
  371. return null;
  372. }
  373. /**
  374. * @return bool
  375. */
  376. public function isAgb(): bool
  377. {
  378. return $this->agb;
  379. }
  380. /**
  381. * @param bool $agb
  382. */
  383. public function setAgb(bool $agb): void
  384. {
  385. $this->agb = $agb;
  386. }
  387. public function isNoVerification(): ?bool
  388. {
  389. return $this->noVerification;
  390. }
  391. public function setNoVerification(?bool $noVerification): static
  392. {
  393. $this->noVerification = $noVerification;
  394. return $this;
  395. }
  396. /**
  397. * @return Collection<int, CompanyDidok>
  398. */
  399. public function getCompanyDidoks(): Collection
  400. {
  401. return $this->companyDidoks;
  402. }
  403. public function getCompanyDidoksAsArray(): array
  404. {
  405. $didoks = [];
  406. $companyDidoks = $this->getCompanyDidoks();
  407. if(!empty($companyDidoks)){
  408. foreach($companyDidoks as $companyDidok){
  409. if($companyDidok instanceof CompanyDidok){
  410. $didoks[$companyDidok->getName()] = $companyDidok->getDidok();
  411. }
  412. }
  413. }
  414. return $didoks;
  415. }
  416. public function addCompanyDidok(CompanyDidok $companyDidok): static
  417. {
  418. if (!$this->companyDidoks->contains($companyDidok)) {
  419. $this->companyDidoks->add($companyDidok);
  420. $companyDidok->setEnterprise($this);
  421. }
  422. return $this;
  423. }
  424. public function removeCompanyDidok(CompanyDidok $companyDidok): static
  425. {
  426. if ($this->companyDidoks->removeElement($companyDidok)) {
  427. // set the owning side to null (unless already changed)
  428. if ($companyDidok->getEnterprise() === $this) {
  429. $companyDidok->setEnterprise(null);
  430. }
  431. }
  432. return $this;
  433. }
  434. /**
  435. * @return Collection<int, Report>
  436. */
  437. public function getReports(): Collection
  438. {
  439. return $this->reports;
  440. }
  441. public function addReport(Report $report): static
  442. {
  443. if (!$this->reports->contains($report)) {
  444. $this->reports->add($report);
  445. $report->setEnterprise($this);
  446. }
  447. return $this;
  448. }
  449. public function removeReport(Report $report): static
  450. {
  451. if ($this->reports->removeElement($report)) {
  452. // set the owning side to null (unless already changed)
  453. if ($report->getEnterprise() === $this) {
  454. $report->setEnterprise(null);
  455. }
  456. }
  457. return $this;
  458. }
  459. public function isCashPurchaseOption(): ?bool
  460. {
  461. return $this->cashPurchaseOption;
  462. }
  463. public function setCashPurchaseOption(?bool $cashPurchaseOption): static
  464. {
  465. $this->cashPurchaseOption = $cashPurchaseOption;
  466. return $this;
  467. }
  468. public function isStackPurchaseOption(): ?bool
  469. {
  470. return $this->stackPurchaseOption;
  471. }
  472. public function setStackPurchaseOption(?bool $stackPurchaseOption): static
  473. {
  474. $this->stackPurchaseOption = $stackPurchaseOption;
  475. return $this;
  476. }
  477. public function isESavOption(): ?bool
  478. {
  479. return $this->eSavOption;
  480. }
  481. public function setESavOption(?bool $eSavOption): static
  482. {
  483. $this->eSavOption = $eSavOption;
  484. return $this;
  485. }
  486. public function getExtendedParicipation(): ?string
  487. {
  488. return $this->extendedParicipation;
  489. }
  490. public function setExtendedParicipation(?string $extendedParicipation): static
  491. {
  492. $this->extendedParicipation = $extendedParicipation;
  493. return $this;
  494. }
  495. public function isContractOption(): ?bool
  496. {
  497. return $this->contractOption;
  498. }
  499. public function setContractOption(bool $contractOption): static
  500. {
  501. $this->contractOption = $contractOption;
  502. return $this;
  503. }
  504. public function getInvitationLinkExpiresAt(): ?int
  505. {
  506. return $this->invitationLinkExpiresAt;
  507. }
  508. public function setInvitationLinkExpiresAt(?int $invitationLinkExpiresAt): static
  509. {
  510. $this->invitationLinkExpiresAt = $invitationLinkExpiresAt;
  511. return $this;
  512. }
  513. /**
  514. * @return bool|null
  515. */
  516. public function getVerificationForNewEmployees(): ?bool
  517. {
  518. return $this->verificationForNewEmployees;
  519. }
  520. /**
  521. * @param bool|null $verificationForNewEmployees
  522. */
  523. public function setVerificationForNewEmployees(?bool $verificationForNewEmployees): void
  524. {
  525. $this->verificationForNewEmployees = $verificationForNewEmployees;
  526. }
  527. public function isSuppressPurchaseEmailsOption(): ?bool
  528. {
  529. return $this->suppressPurchaseEmailsOption;
  530. }
  531. public function setSuppressPurchaseEmailsOption(?bool $suppressPurchaseEmailsOption): void
  532. {
  533. $this->suppressPurchaseEmailsOption = $suppressPurchaseEmailsOption;
  534. }
  535. /**
  536. * @return Collection<int, RegistrationLink>
  537. */
  538. public function getRegistrationLinks(): Collection
  539. {
  540. return $this->registrationLinks;
  541. }
  542. public function addRegistrationLink(RegistrationLink $registrationLink): static
  543. {
  544. if (!$this->registrationLinks->contains($registrationLink)) {
  545. $this->registrationLinks->add($registrationLink);
  546. $registrationLink->setEnterprise($this);
  547. }
  548. return $this;
  549. }
  550. public function removeRegistrationLink(RegistrationLink $registrationLink): static
  551. {
  552. if ($this->registrationLinks->removeElement($registrationLink)) {
  553. // set the owning side to null (unless already changed)
  554. if ($registrationLink->getEnterprise() === $this) {
  555. $registrationLink->setEnterprise(null);
  556. }
  557. }
  558. return $this;
  559. }
  560. public function getLocale(): ?string
  561. {
  562. return $this->locale;
  563. }
  564. public function setLocale(?string $locale): static
  565. {
  566. $this->locale = $locale;
  567. return $this;
  568. }
  569. /**
  570. * @return Collection<int, ProcessedPaymentPeriod>
  571. */
  572. public function getProcessedPaymentPeriods(): Collection
  573. {
  574. return $this->processedPaymentPeriods;
  575. }
  576. public function addProcessedPaymentPeriod(ProcessedPaymentPeriod $processedPaymentPeriod): static
  577. {
  578. if (!$this->processedPaymentPeriods->contains($processedPaymentPeriod)) {
  579. $this->processedPaymentPeriods->add($processedPaymentPeriod);
  580. $processedPaymentPeriod->setEnterprise($this);
  581. }
  582. return $this;
  583. }
  584. public function removeProcessedPaymentPeriod(ProcessedPaymentPeriod $processedPaymentPeriod): static
  585. {
  586. if ($this->processedPaymentPeriods->removeElement($processedPaymentPeriod)) {
  587. if ($processedPaymentPeriod->getEnterprise() === $this) {
  588. $processedPaymentPeriod->setEnterprise(null);
  589. }
  590. }
  591. return $this;
  592. }
  593. public function isCreateSwissPassOption(): ?bool
  594. {
  595. return $this->createSwissPassOption;
  596. }
  597. public function setCreateSwissPassOption(?bool $createSwissPassOption): static
  598. {
  599. $this->createSwissPassOption = $createSwissPassOption;
  600. return $this;
  601. }
  602. public function getDistrict(): ?string
  603. {
  604. return $this->district;
  605. }
  606. public function setDistrict(?string $district): static
  607. {
  608. $this->district = $district;
  609. return $this;
  610. }
  611. public function isRemainingBalanceOption(): ?bool
  612. {
  613. return $this->remainingBalanceOption;
  614. }
  615. public function setRemainingBalanceOption(?bool $remainingBalanceOption): static
  616. {
  617. $this->remainingBalanceOption = $remainingBalanceOption;
  618. return $this;
  619. }
  620. public function isReminderOrRemainingBalanceRenewalOption(): ?bool
  621. {
  622. if($this->reminderOption || $this->remainingBalanceRenewalOption){
  623. return true;
  624. }
  625. return false;
  626. }
  627. public function getRemainingBalanceRenewalOption(): ?bool
  628. {
  629. return $this->remainingBalanceRenewalOption;
  630. }
  631. public function setRemainingBalanceRenewalOption(?bool $remainingBalanceRenewalOption): void
  632. {
  633. $this->remainingBalanceRenewalOption = $remainingBalanceRenewalOption;
  634. }
  635. public function getDocumentUploadOption(): ?bool
  636. {
  637. return $this->documentUploadOption;
  638. }
  639. public function setDocumentUploadOption(?bool $documentUploadOption): void
  640. {
  641. $this->documentUploadOption = $documentUploadOption;
  642. }
  643. public function getRemainingBalanceStartDate(): ?\DateTimeInterface
  644. {
  645. return $this->remainingBalanceStartDate;
  646. }
  647. public function setRemainingBalanceStartDate(?\DateTimeInterface $remainingBalanceStartDate): static
  648. {
  649. $this->remainingBalanceStartDate = $remainingBalanceStartDate;
  650. return $this;
  651. }
  652. public function isStartRemainingBalanceOnPurchase(): ?bool
  653. {
  654. return $this->startRemainingBalanceOnPurchase;
  655. }
  656. public function setStartRemainingBalanceOnPurchase(?bool $startRemainingBalanceOnPurchase): static
  657. {
  658. $this->startRemainingBalanceOnPurchase = $startRemainingBalanceOnPurchase;
  659. return $this;
  660. }
  661. public function isReminderOption(): ?bool
  662. {
  663. return $this->reminderOption;
  664. }
  665. public function setReminderOption(?bool $reminderOption): static
  666. {
  667. $this->reminderOption = $reminderOption;
  668. return $this;
  669. }
  670. public function getTu(): ?Tu
  671. {
  672. return $this->tu;
  673. }
  674. public function setTu(?Tu $tu): static
  675. {
  676. $this->tu = $tu;
  677. return $this;
  678. }
  679. public function getCustomerNumber(): ?string
  680. {
  681. return $this->customerNumber;
  682. }
  683. public function setCustomerNumber(?string $customerNumber): static
  684. {
  685. $this->customerNumber = $customerNumber;
  686. return $this;
  687. }
  688. public function getLogoFilename(): ?string
  689. {
  690. return $this->logoFilename;
  691. }
  692. public function setLogoFilename(?string $logoFilename): static
  693. {
  694. $this->logoFilename = $logoFilename;
  695. return $this;
  696. }
  697. public function getLogoMimeType(): ?string
  698. {
  699. return $this->logoMimeType;
  700. }
  701. public function setLogoMimeType(?string $logoMimeType): static
  702. {
  703. $this->logoMimeType = $logoMimeType;
  704. return $this;
  705. }
  706. public function hasLogo(): bool
  707. {
  708. return !empty($this->logoFilename);
  709. }
  710. /**
  711. * @return Collection<int, PricingModel>
  712. */
  713. public function getPricingModels(): Collection
  714. {
  715. return $this->pricingModels;
  716. }
  717. public function addPricingModel(PricingModel $pricingModel): static
  718. {
  719. if (!$this->pricingModels->contains($pricingModel)) {
  720. $this->pricingModels->add($pricingModel);
  721. }
  722. return $this;
  723. }
  724. public function removePricingModel(PricingModel $pricingModel): static
  725. {
  726. $this->pricingModels->removeElement($pricingModel);
  727. return $this;
  728. }
  729. public function isAllZonesOption(): ?bool
  730. {
  731. return $this->allZonesOption;
  732. }
  733. public function setAllZonesOption(?bool $allZonesOption): static
  734. {
  735. $this->allZonesOption = $allZonesOption;
  736. return $this;
  737. }
  738. /**
  739. * @return Collection<int, ModuleSubscription>
  740. */
  741. public function getModuleSubscriptions(): Collection
  742. {
  743. return $this->moduleSubscriptions;
  744. }
  745. public function addModuleSubscription(ModuleSubscription $moduleSubscription): self
  746. {
  747. if (!$this->moduleSubscriptions->contains($moduleSubscription)) {
  748. $this->moduleSubscriptions->add($moduleSubscription);
  749. $moduleSubscription->setEnterprise($this);
  750. }
  751. return $this;
  752. }
  753. public function removeModuleSubscription(ModuleSubscription $moduleSubscription): self
  754. {
  755. if ($this->moduleSubscriptions->removeElement($moduleSubscription)) {
  756. // set the owning side to null (unless already changed)
  757. if ($moduleSubscription->getEnterprise() === $this) {
  758. $moduleSubscription->setEnterprise(null);
  759. }
  760. }
  761. return $this;
  762. }
  763. public function getCountryRestriction(): ?array
  764. {
  765. return $this->countryRestriction;
  766. }
  767. public function setCountryRestriction(?array $countryRestriction): static
  768. {
  769. $this->countryRestriction = $countryRestriction;
  770. return $this;
  771. }
  772. public function getCountryRestrictionAsUrlParams(): string
  773. {
  774. if (empty($this->countryRestriction)) {
  775. $this->countryRestriction = ['CH'];
  776. }
  777. return json_encode(
  778. ['countries' => $this->countryRestriction],
  779. JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
  780. );
  781. }
  782. public function getSupportedClass(): ?int
  783. {
  784. return $this->supportedClass;
  785. }
  786. public function setSupportedClass(?int $supportedClass): static
  787. {
  788. $this->supportedClass = $supportedClass;
  789. return $this;
  790. }
  791. public function getAllowedProducts(): ?array
  792. {
  793. return $this->allowedProducts;
  794. }
  795. public function setAllowedProducts(?array $allowedProducts): static
  796. {
  797. $this->allowedProducts = $allowedProducts;
  798. return $this;
  799. }
  800. }