Skip to content

Commit 2a13b5f

Browse files
committed
Merge branch 'develop/1.5.0'
2 parents fbc7d5c + ca5564e commit 2a13b5f

15 files changed

+1117
-809
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Console/Command/RegenerateUrlRewrites.php

+7-41
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @package OlegKoval_RegenerateUrlRewrites
66
* @author Oleg Koval <[email protected]>
7-
* @copyright 2018 Oleg Koval
7+
* @copyright 2017-2067 Oleg Koval
88
* @license OSL-3.0, AFL-3.0
99
*/
1010

@@ -16,7 +16,7 @@
1616
use Symfony\Component\Console\Input\InputOption;
1717
use Symfony\Component\Console\Output\OutputInterface;
1818

19-
class RegenerateUrlRewrites extends RegenerateUrlRewritesCategoryAbstract
19+
class RegenerateUrlRewrites extends RegenerateUrlRewritesAbstract
2020
{
2121
/**
2222
* @var null|Symfony\Component\Console\Input\InputInterface
@@ -102,12 +102,6 @@ protected function configure()
102102
InputArgument::OPTIONAL,
103103
'Specific product ID, e.g.: 107 (Pro version only)'
104104
),
105-
new InputOption(
106-
self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL,
107-
null,
108-
InputOption::VALUE_NONE,
109-
'Check if product use categories in URL'
110-
),
111105
new InputOption(
112106
self::INPUT_KEY_NO_REGEN_URL_KEY,
113107
null,
@@ -150,37 +144,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
150144

151145
foreach ($this->_commandOptions['storesList'] as $storeId => $storeCode) {
152146
$this->_output->writeln('');
153-
$this->_output->writeln("[Store ID: {$storeId}, Store View code: {$storeCode}]:");
147+
$this->_output->writeln("[Type: {$this->_commandOptions['entityType']}, Store ID: {$storeId}, Store View code: {$storeCode}]:");
154148
$this->_storeManager->setCurrentStore($storeId);
155149

156150
if ($this->_commandOptions['entityType'] == self::INPUT_KEY_REGENERATE_ENTITY_TYPE_PRODUCT) {
157-
if (count($this->_commandOptions['productsFilter']) > 0) {
158-
$this->regenerateProductsRangeUrlRewrites(
159-
$this->_commandOptions['productsFilter'],
160-
$storeId
161-
);
162-
} elseif (!empty($this->_commandOptions['productId'])) {
163-
$this->regenerateSpecificProductUrlRewrites(
164-
$this->_commandOptions['productId'],
165-
$storeId
166-
);
167-
} else {
168-
$this->regenerateAllProductsUrlRewrites($storeId);
169-
}
151+
$this->regenerateProductRewrites->regenerateOptions = $this->_commandOptions;
152+
$this->regenerateProductRewrites->regenerate($storeId);
170153
} elseif ($this->_commandOptions['entityType'] == self::INPUT_KEY_REGENERATE_ENTITY_TYPE_CATEGORY) {
171-
if (count($this->_commandOptions['categoriesFilter']) > 0) {
172-
$this->regenerateCategoriesRangeUrlRewrites(
173-
$this->_commandOptions['categoriesFilter'],
174-
$storeId
175-
);
176-
} elseif (!empty($this->_commandOptions['categoryId'])) {
177-
$this->regenerateSpecificCategoryUrlRewrites(
178-
$this->_commandOptions['categoryId'],
179-
$storeId
180-
);
181-
} else {
182-
$this->regenerateAllCategoriesUrlRewrites($storeId);
183-
}
154+
$this->regenerateCategoryRewrites->regenerateOptions = $this->_commandOptions;
155+
$this->regenerateCategoryRewrites->regenerate($storeId);
184156
}
185157
}
186158

@@ -240,12 +212,6 @@ public function getCommandOptions()
240212
$this->_commandOptions['runCacheFlush'] = false;
241213
}
242214

243-
if (
244-
isset($options[self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL])
245-
&& $options[self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL] === true) {
246-
$this->_commandOptions['checkUseCategoryInProductUrl'] = true;
247-
}
248-
249215
if (isset($options[self::INPUT_KEY_PRODUCTS_RANGE])) {
250216
$this->_commandOptions['productsFilter'] = $this->_generateIdsRangeArray(
251217
$options[self::INPUT_KEY_PRODUCTS_RANGE],

0 commit comments

Comments
 (0)