protected function execute(InputInterface $input, OutputInterface $output)
{
$storeId = $input->getArgument('storeId');
if (!is_numeric($storeId)) {
throw new \Exception('Invalid store ID');
}
$db = Db::get();
$tableList = $db->fetchAll("show tables like 'object_classificationstore_data_%'");
foreach ($tableList as $table) {
$theTable = current($table);
$sql = "delete from " . $theTable . " where keyId In (select id from classificationstore_keys where storeId = " . $db->quote($storeId) . ")";
echo $sql . "\n";
$db->query($sql);
}
$tableList = $db->fetchAll("show tables like 'object_classificationstore_groups_%'");
foreach ($tableList as $table) {
$theTable = current($table);
$sql = "delete from " . $theTable . " where groupId In (select id from classificationstore_groups where storeId = " . $db->quote($storeId) . ")";
echo $sql . "\n";
$db->query($sql);
}
$sql = "delete from classificationstore_keys where storeId = " . $db->quote($storeId);
echo $sql . "\n";
$db->query($sql);
$sql = "delete from classificationstore_groups where storeId = " . $db->quote($storeId);
echo $sql . "\n";
$db->query($sql);
$sql = "delete from classificationstore_collections where storeId = " . $db->quote($storeId);
echo $sql . "\n";
$db->query($sql);
$sql = "delete from classificationstore_stores where id = " . $db->quote($storeId);
echo $sql . "\n";
$db->query($sql);
Cache::clearAll();
}