First of all: the corresponding types of skeleton are located here:
vendor/bundles/Sensio/Bundle/GeneratorBundle/Resources/skeleton/crud
Quick and dirty, you should be fine overriding these view files - but that's not what we want;)
IN:
vendor/bundles/Sensio/Bundle/GeneratorBundle/Command/GenerateDoctrineCrudCommand.php
there is an accessor for the generator:
protected function getGenerator() { if (null === $this->generator) { $this->generator = new DoctrineCrudGenerator($this->getContainer()->get('filesystem'), __DIR__.'/../Resources/skeleton/crud'); } return $this->generator; }
You can try to override this method in the Bundle extension and set another $skeletonDir in the constructor.
Edit:
A quick example in my test environment how this can be achieved (I just did a quick test;):
Create a new package for the custom generator: php app/console generate:bundle and follow the instructions. The route is not needed. I chose for this example: Acme / CrudGeneratorBundle (or use an existing package)
Create a folder named "Command" in the new package directory.
Put the command class in this folder.
<?php //src/Acme/CrudGeneratorBundle/Command/MyDoctrineCrudCommand.php namespace Acme\CrudGeneratorBundle\Command; use Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator; class MyDoctrineCrudCommand extends \Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand { protected function configure() { parent::configure(); $this->setName('mydoctrine:generate:crud'); } protected function getGenerator() { $generator = new DoctrineCrudGenerator($this->getContainer()->get('filesystem'), __DIR__.'/../Resources/skeleton/crud'); $this->setGenerator($generator); return parent::getGenerator(); } }
Copy the provider / packages / Sensio / Bundle / GeneratorBundle / Resources / skeleton / crud to your resources (in my example "src / Acme / CrudGeneratorBundle / Resources / crud")
madflow
source share