检查configure
您的任务的方法,您应该会看到类似的内容:
new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'backend'),
替换backend
为frontend
。
编辑:
根据您的发现(关于getFirstApplication
),最好的解决方案是创建您自己的任务(在 中/lib/task/myDoctrineBuildTask.class.php
)来扩展当前的学说任务。然后frontend
在方法中定义应用configure
:
class myDoctrineBuildTask extends sfDoctrineBuildTask
{
/**
* @see sfTask
*/
protected function configure()
{
$this->addOptions(array(
new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', 'frontend'),
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Whether to force dropping of the database'),
new sfCommandOption('all', null, sfCommandOption::PARAMETER_NONE, 'Build everything and reset the database'),
new sfCommandOption('all-classes', null, sfCommandOption::PARAMETER_NONE, 'Build all classes'),
new sfCommandOption('model', null, sfCommandOption::PARAMETER_NONE, 'Build model classes'),
new sfCommandOption('forms', null, sfCommandOption::PARAMETER_NONE, 'Build form classes'),
new sfCommandOption('filters', null, sfCommandOption::PARAMETER_NONE, 'Build filter classes'),
new sfCommandOption('sql', null, sfCommandOption::PARAMETER_NONE, 'Build SQL'),
new sfCommandOption('db', null, sfCommandOption::PARAMETER_NONE, 'Drop, create, and either insert SQL or migrate the database'),
new sfCommandOption('and-migrate', null, sfCommandOption::PARAMETER_NONE, 'Migrate the database'),
new sfCommandOption('and-load', null, sfCommandOption::PARAMETER_OPTIONAL | sfCommandOption::IS_ARRAY, 'Load fixture data'),
new sfCommandOption('and-append', null, sfCommandOption::PARAMETER_OPTIONAL | sfCommandOption::IS_ARRAY, 'Append fixture data'),
));
$this->namespace = 'mydoctrine';
$this->name = 'build';
$this->briefDescription = 'Generate code based on your schema';
$this->detailedDescription = ''; // feel free to re-add all the doc
}
}
然后,使用以下命令启动构建:php symfony mydoctrine:build --all-classes