Changeset 8512
- Timestamp:
- 04/17/08 20:06:12 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r8508 r8512 52 52 } 53 53 54 if (!isset($this->params['model_dir_name'])) 55 { 56 $this->params['model_dir_name'] = 'model'; 57 } 58 59 if (!isset($this->params['form_dir_name'])) 60 { 61 $this->params['form_dir_name'] = 'form'; 62 } 63 54 64 $this->loadBuilders(); 55 65 … … 75 85 // find the package to store forms in the same directory as the model classes 76 86 $packages = explode('.', constant($table->getPhpName().'Peer::CLASS_DEFAULT')); 77 $baseDir = sfConfig::get('sf_root_dir').'/'.implode(DIRECTORY_SEPARATOR, array_slice($packages, 0, count($packages) - 2)).'/form'; 87 array_pop($packages); 88 if (false === $pos = array_search($this->params['model_dir_name'], $packages)) 89 { 90 throw new InvalidArgumentException(sprintf('Unable to find the model dir name (%s) in the package %s.', $this->params['model_dir_name'], constant($table->getPhpName().'Peer::CLASS_DEFAULT'))); 91 } 92 $packages[$pos] = $this->params['form_dir_name']; 93 $baseDir = sfConfig::get('sf_root_dir').'/'.implode(DIRECTORY_SEPARATOR, $packages); 78 94 79 95 if (!is_dir($baseDir.'/base')) branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildFormsTask.class.php
r7614 r8512 28 28 $this->addOptions(array( 29 29 new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), 30 new sfCommandOption('model-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The model dir name', 'model'), 31 new sfCommandOption('form-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The form dir name', 'form'), 30 32 )); 31 33 … … 63 65 $generatorManager = new sfGeneratorManager($this->configuration); 64 66 65 $generatorManager->generate('sfPropelFormGenerator', array('connection' => $options['connection'])); 67 $generatorManager->generate('sfPropelFormGenerator', array( 68 'connection' => $options['connection'], 69 'model_dir_name' => $options['model-dir-name'], 70 'form_dir_name' => $options['form-dir-name'], 71 )); 66 72 } 67 73 }