matthiasnoback / console-command-generator-bundle
用于生成 Symfony2 命令的包
dev-master
2014-06-13 14:48 UTC
Requires
- sensio/generator-bundle: ~2.2
This package is auto-updated.
Last update: 2024-08-29 04:37:30 UTC
README
使用 Composer 安装此包。在 app/AppKernel.php
中注册包,然后运行
app/console generate:console-command
系统将要求您提供一些信息,之后将自动为您生成命令类。
生成的控制台命令将类似于以下内容
namespace Matthias\Bundle\DemoBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class CreatePostCommand extends ContainerAwareCommand { protected function configure() { $this ->setName('post:create') ->addArgument('title', InputArgument::REQUIRED, null, null) ; } protected function execute(InputInterface $input, OutputInterface $output) { } }