Skip to content

Conversation

@vahonc
Copy link
Collaborator

@vahonc vahonc commented Aug 29, 2025

No description provided.

$rows = $connection->fetchAll($select);

if (!$rows) {
$output->writeln("<comment>No products found for category {$categoryId}</comment>");
Copy link
Collaborator

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>");
Copy link
Collaborator

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.");
Copy link
Collaborator

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.");
Copy link
Collaborator

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>");
Copy link
Collaborator

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>");
Copy link
Collaborator

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".

Copy link
Collaborator

@romainruaud romainruaud left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants