2022-03-17 10:35:14 +08:00
|
|
|
<?php
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gii;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Kiri\Abstracts\Providers;
|
2022-06-22 16:29:42 +08:00
|
|
|
use Kiri\Di\LocalService;
|
|
|
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
|
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
|
use Symfony\Component\Console\Application;
|
2022-03-17 10:35:14 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class DatabasesProviders
|
|
|
|
|
* @package Database
|
|
|
|
|
*/
|
|
|
|
|
class GiiProviders extends Providers
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-22 16:29:42 +08:00
|
|
|
* @param LocalService $application
|
|
|
|
|
* @return void
|
|
|
|
|
* @throws ContainerExceptionInterface
|
|
|
|
|
* @throws NotFoundExceptionInterface
|
2022-03-17 10:35:14 +08:00
|
|
|
*/
|
2022-06-22 16:29:42 +08:00
|
|
|
public function onImport(LocalService $application): void
|
2022-03-17 10:35:14 +08:00
|
|
|
{
|
|
|
|
|
$application->set('gii', ['class' => Gii::class]);
|
|
|
|
|
|
2022-06-22 16:29:42 +08:00
|
|
|
$console = $this->container->get(Application::class);
|
|
|
|
|
$console->add($this->container->get(GiiCommand::class));
|
2022-03-17 10:35:14 +08:00
|
|
|
}
|
|
|
|
|
}
|