// Bundle\YourBundle.php
// other declarations
use Symfony\Component\Console\Application;
use Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator;
use Symfony\Component\Filesystem\Filesystem;
public function registerCommands(Application $application){
$crudCommand = $application->get('generate:doctrine:crud');
$generator = new DoctrineCrudGenerator(new FileSystem, __DIR__.'/Resources/skeleton/crud');
$crudCommand->setGenerator($generator);
parent::registerCommands($application);
}
あなたは
YourBundle\Resource
に
skeleton
フォルダをコピーして、テンプレートを変更する必要があり、右
app/AppKernel.php
例えば:
// app/AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
//.....
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Namespace\YourBundle();
}
// Or outside if, should you want your bundle to be available in production environment
$bundles[] = new Namespace\YourBundle();
でSensioGeneratorBundle
後に続いてYourBundle.php
オーバーライドregisterCommands
方法であなたのバンドルを登録します。
は、それが代わりに「index.html.twig.twig」拡張子ではないでしょうか?ダブル「小枝」に注意してください。 http://symfony.com/doc/current/bundles/SensioGeneratorBundle/index.html – DevWL