symfony task doctrine:custom-build-sql
Нашел небольшой класс для генерации sql файла для моделей sfDoctrineCustomBuildSqlTask.class.php
* @author Jonathan H. Wage
* @version SVN: $Id: sfDoctrineBuildSqlTask.class.php 23922 2009-11-14 14:58:38Z fabien $
*/
class sfDoctrineCustomBuildSqlTask extends sfDoctrineBaseTask
{
/**
* @see sfTask
*/
protected function configure()
{
$this->addOptions(array(
new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
));
$this->namespace = 'doctrine';
$this->name = 'custom-build-sql';
$this->briefDescription = 'Creates SQL for the current model';
$this->detailedDescription = <<logSection('doctrine', 'generating sql for models');
$path = sfConfig::get('sf_data_dir').'/sql';
if (!is_dir($path)) {
$this->getFilesystem()->mkdirs($path);
}
$args['models_path'] = array(sfConfig::get('sf_lib_dir').'/package', sfConfig::get('sf_lib_dir').'/model');
$databaseManager = new sfDatabaseManager($this->configuration);
$this->callDoctrineCli('generate-sql', $args);
}
}