Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

43 lines
1.3KB

  1. <?php
  2. namespace common\logic\Setting;
  3. use common\logic\AbstractManager;
  4. use common\logic\Setting\SettingDetails\Admin\AdminSettingDefinition;
  5. class SettingImporter extends AbstractManager
  6. {
  7. protected AdminSettingDefinition $adminSettingDefinition;
  8. protected SettingBuilder $settingBuilder;
  9. public function loadDependencies(): void
  10. {
  11. $this->adminSettingDefinition = $this->loadService(AdminSettingDefinition::class);
  12. $this->settingBuilder = $this->loadService(SettingBuilder::class);
  13. }
  14. public function importFromDefinitions()
  15. {
  16. $this->importFromAdminSettingDefinition();
  17. $this->importFromProducerSettingDefinition();
  18. }
  19. public function importFromAdminSettingDefinition(): void
  20. {
  21. \Yii::$app->logic->setProducerContext(null);
  22. $settingDetails = $this->adminSettingDefinition->getSettingDetails();
  23. foreach($settingDetails as $subsectionsArray) {
  24. foreach($subsectionsArray as $settingDetailsArray) {
  25. foreach($settingDetailsArray as $settingDetail) {
  26. $this->settingBuilder->createSetting($settingDetail->getName());
  27. }
  28. }
  29. }
  30. }
  31. public function importFromProducerSettingDefinition(): void
  32. {
  33. // /!\ bien définir le contexte producteur
  34. }
  35. }