Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

Commit c6d6559

Browse files
author
Florian Horn
committed
Simplified extension of configuration model
1 parent 7394353 commit c6d6559

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file, in reverse
77
- Added default value for URLs
88
- Added possibility to extend data on configuration model
99
- Refactored fuzzyfyr structure
10+
- Simplified extension of configuration model
1011
- Added fuzzyfyr for CMS Pages
1112
- Added fuzzyfyr for CMS Blocks
1213
- Extended fuzzyfyr for Customers with address fuzzing

Console/Command/FuzzyfyrCommand.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,28 @@ protected function execute(InputInterface $input, OutputInterface $output)
181181
$this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
182182

183183
/*
184-
* Input
184+
* Configuration
185185
*/
186-
/** @var Configuration $configuration */
187-
$configuration = $this->configurationFactory->create();
186+
$configuration = $this->loadConfiguration(
187+
$this->configurationFactory->create(),
188+
$input
189+
);
190+
191+
/*
192+
* Processing
193+
*/
194+
$this->eventManager->dispatch('aid_content_fuzzyfyr_event', ['configuration' => $configuration]);
195+
196+
$output->writeln('Finished content fuzzyfy');
197+
}
198+
199+
/**
200+
* @param Configuration $configuration
201+
* @param InputInterface $input
202+
* @return Configuration
203+
*/
204+
protected function loadConfiguration(Configuration $configuration, InputInterface $input)
205+
{
188206
// --- Flags
189207
$configuration->setUseOnlyEmpty($input->getOption(self::FLAG_ONLY_EMPTY));
190208
$configuration->setApplyToCategories($input->getOption(self::FLAG_CATEGORIES));
@@ -193,17 +211,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
193211
$configuration->setApplyToCustomers($input->getOption(self::FLAG_CUSTOMERS));
194212
$configuration->setApplyToProducts($input->getOption(self::FLAG_PRODUCTS));
195213
$configuration->setApplyToUsers($input->getOption(self::FLAG_USERS));
214+
196215
// --- Options
197216
$configuration->setDummyContentText($input->getOption(self::OPTION_DUMMY_CONTENT_TEXT));
198217
$configuration->setDummyContentEmail($input->getOption(self::OPTION_DUMMY_CONTENT_EMAIL));
199218
$configuration->setDummyContentUrl($input->getOption(self::OPTION_DUMMY_CONTENT_URL));
200219
$configuration->setDummyPhoneNumber($input->getOption(self::OPTION_DUMMY_CONTENT_PHONE));
201220

202-
/*
203-
* Processing
204-
*/
205-
$this->eventManager->dispatch('aid_content_fuzzyfyr_event', ['configuration' => $configuration]);
206-
207-
$output->writeln('Finished content fuzzyfy');
221+
return $configuration;
208222
}
209223
}

0 commit comments

Comments
 (0)