39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Entity\Menu;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
#[AsCommand(name: 'opengnsys:load-default-menu', description: 'Load the default menu')]
|
|
class LoadDefaultMenuCommand extends Command
|
|
{
|
|
public function __construct(
|
|
private readonly EntityManagerInterface $entityManager
|
|
)
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$menu = new Menu();
|
|
$menu->setName('Default menu');
|
|
$menu->setResolution('1920x1080');
|
|
$menu->setComments('Default menu comments');
|
|
$menu->setPublicUrl('main');
|
|
$menu->setDefault(true);
|
|
|
|
$this->entityManager->persist($menu);
|
|
$this->entityManager->flush();
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|