Files
hyperf-micro-svc/app/Command/GenClass/RepositoryGenCommand.php
2025-09-12 15:23:08 +08:00

52 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Command\GenClass;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Hyperf\Devtool\Generator\GeneratorCommand;
use Psr\Container\ContainerInterface;
#[Command]
class RepositoryGenCommand extends GeneratorCommand
{
/**
* @param ContainerInterface $container
*/
public function __construct(protected ContainerInterface $container)
{
parent::__construct('gen:repository');
}
/**
* @return void
*/
public function configure(): void
{
parent::configure();
$this->setDescription('Create a new repository class');
$this->setHelp('php bin/hyperf.php gen:repository fileRepository');
}
/**
* 获取 stubs
* @return string
*/
protected function getStub(): string
{
return __DIR__ . '/stubs/repository.stub';
}
/**
* 获取默认命名空间
* @return string
*/
protected function getDefaultNamespace(): string
{
return 'App\\Repository';
}
}