-
Notifications
You must be signed in to change notification settings - Fork 351
[WIP] [Catalog] Feature #3464, migrate legacy product positions in categories to ElasticSuite #3698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.10.x
Are you sure you want to change the base?
Conversation
…categories to ElasticSuite
| $rows = $connection->fetchAll($select); | ||
|
|
||
| if (!$rows) { | ||
| $output->writeln("<comment>No products found for category {$categoryId}</comment>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
| } | ||
|
|
||
| if (!$silentMode) { | ||
| $output->writeln("<info>Found " . count($rows) . " products</info>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
|
|
||
| // Step 3: persist or preview. | ||
| if ($dryRun) { | ||
| $output->writeln("<comment>[Dry-Run]</comment> Category {$categoryId}: would migrate " . count($normalized) . " products."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
| if ($dryRun) { | ||
| $output->writeln("<comment>[Dry-Run]</comment> Category {$categoryId}: would migrate " . count($normalized) . " products."); | ||
| if (!empty($toDelete)) { | ||
| $output->writeln("<comment>[Dry-Run]</comment> Would delete " . count($toDelete) . " products due to conflicts."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
| $table, | ||
| ['category_id = ?' => $categoryId, 'product_id IN (?)' => $toDelete] | ||
| ); | ||
| $output->writeln("<comment>Deleted " . count($toDelete) . " products due to conflicts.</comment>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
| } | ||
|
|
||
| $connection->commit(); | ||
| $output->writeln("<info>Category {$categoryId}: migrated " . count($normalized) . " products.</info>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "products" but "products positions".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall logic looks OK for me (however, I did not test it), but you can proceed moving some logics into dedicated models classes.
Regards
No description provided.