Files
esun3d/app/code/Esun/Wiki/Setup/Patch/Data/ConfigureWikiCustomUrls.php
2026-09-15 10:35:56 +08:00

47 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Esun\Wiki\Setup\Patch\Data;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
class ConfigureWikiCustomUrls implements DataPatchInterface
{
private const URLS = [
'material-datasheets' => 'page-filter',
'printing-parameters-download' => 'parameters-download',
];
public function __construct(
private readonly ModuleDataSetupInterface $moduleDataSetup
) {
}
public function apply(): self
{
$connection = $this->moduleDataSetup->getConnection();
$table = $this->moduleDataSetup->getTable('esun_wiki_category');
foreach (self::URLS as $slug => $customPath) {
$connection->update(
$table,
['custom_url_path' => $customPath],
['slug = ?' => $slug]
);
}
return $this;
}
public static function getDependencies(): array
{
return [];
}
public function getAliases(): array
{
return [];
}
}