init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\Wiki\Setup\Patch\Data;
|
||||
|
||||
use Magento\Framework\Setup\ModuleDataSetupInterface;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class CreateDefaultWikiHomepage implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ModuleDataSetupInterface $moduleDataSetup
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$connection = $this->moduleDataSetup->getConnection();
|
||||
$table = $this->moduleDataSetup->getTable('esun_wiki_homepage');
|
||||
|
||||
$connection->startSetup();
|
||||
if ((int) $connection->fetchOne($connection->select()->from($table, 'COUNT(*)')) === 0) {
|
||||
$connection->insert($table, [
|
||||
'title' => 'eSUN Wiki',
|
||||
'content' => '',
|
||||
'meta_title' => '',
|
||||
'meta_description' => '',
|
||||
'meta_keywords' => '',
|
||||
]);
|
||||
}
|
||||
$connection->endSetup();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user