1 | <?php |
||
29 | class Products extends AbstractUrlRewriteCommand |
||
30 | { |
||
31 | |||
32 | /** |
||
33 | * Name of product input option |
||
34 | */ |
||
35 | const INPUT_PRODUCT = 'product'; |
||
36 | |||
37 | /** |
||
38 | * Force of force input option |
||
39 | */ |
||
40 | const INPUT_FORCE = 'force'; |
||
41 | |||
42 | /** |
||
43 | * Name of product input option |
||
44 | */ |
||
45 | const INPUT_STORE = 'store'; |
||
46 | |||
47 | /** |
||
48 | * @var \Magento\Catalog\Model\ResourceModel\Product\Collection |
||
49 | */ |
||
50 | protected $_collection = null; |
||
51 | |||
52 | /** |
||
53 | * Collections to process |
||
54 | */ |
||
55 | protected $_collections = []; |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | protected function configure() |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | protected function execute(InputInterface $input, OutputInterface $output) |
||
109 | |||
110 | /** |
||
111 | * Generate product url by product |
||
112 | * @param $args |
||
113 | */ |
||
114 | public function callbackGenerateProductUrl($args) |
||
147 | |||
148 | /** |
||
149 | * Remove Product urls |
||
150 | * |
||
151 | * @param $productId |
||
152 | * @param null $storeId |
||
153 | * @return bool |
||
154 | */ |
||
155 | protected function removeProductUrls($productId, $storeId = null) |
||
176 | |||
177 | /** |
||
178 | * Generate list of product urls |
||
179 | * |
||
180 | * @param $product |
||
181 | * @return array |
||
182 | */ |
||
183 | private function prepareUrls($product) |
||
187 | |||
188 | /** |
||
189 | * Get Product Url Generator |
||
190 | * |
||
191 | * @return \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator |
||
192 | */ |
||
193 | protected function getProductUrlRewriteGenerator() |
||
197 | |||
198 | /** |
||
199 | * Prepare Collections to process |
||
200 | * |
||
201 | * @param $storeId |
||
202 | * @param $productIds |
||
203 | * @throws \Exception |
||
204 | */ |
||
205 | protected function prepareCollections($storeId, $productIds) |
||
226 | |||
227 | /** |
||
228 | * Get product collection |
||
229 | * |
||
230 | * @return \Magento\Catalog\Model\ResourceModel\Product\Collection |
||
231 | */ |
||
232 | protected function getProductCollection() |
||
240 | |||
241 | /** |
||
242 | * Filter collection by product ID |
||
243 | * |
||
244 | * @param null $productIds |
||
245 | */ |
||
246 | private function addFilterProductIds($productIds = null) |
||
253 | |||
254 | /** |
||
255 | * Filter Collection by Store |
||
256 | * |
||
257 | * @param null $storeId |
||
258 | */ |
||
259 | private function addStoreFilter($storeId = null) |
||
268 | |||
269 | /** |
||
270 | * Add collection to process |
||
271 | * |
||
272 | * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection |
||
273 | * @param $storeId |
||
274 | */ |
||
275 | protected function addCollections(\Magento\Catalog\Model\ResourceModel\Product\Collection $collection, $storeId) |
||
279 | |||
280 | /** |
||
281 | * Number of Items to process |
||
282 | * |
||
283 | * @return int |
||
284 | */ |
||
285 | protected function getSizeToProcess() |
||
293 | |||
294 | /** |
||
295 | * Rebuild Urls |
||
296 | */ |
||
297 | protected function rebuildUrls() |
||
311 | |||
312 | /** |
||
313 | * Create product factory |
||
314 | * |
||
315 | * @return \Magento\Catalog\Model\ProductFactory |
||
316 | */ |
||
317 | protected function getProductFactory() |
||
321 | } |