Development

Changeset 8512

You must first sign up to be able to contribute.

Changeset 8512

Show
Ignore:
Timestamp:
04/17/08 20:06:12 (5 months ago)
Author:
fabien
Message:

forced all generated for classes to be under form/ even when the Propel schema package is not lib.model (if you have such schemas, please rebuild your forms and move your form classes manually)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php

    r8508 r8512  
    5252    } 
    5353 
     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 
    5464    $this->loadBuilders(); 
    5565 
     
    7585      // find the package to store forms in the same directory as the model classes 
    7686      $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); 
    7894 
    7995      if (!is_dir($baseDir.'/base')) 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildFormsTask.class.php

    r7614 r8512  
    2828    $this->addOptions(array( 
    2929      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'), 
    3032    )); 
    3133 
     
    6365    $generatorManager = new sfGeneratorManager($this->configuration); 
    6466 
    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    )); 
    6672  } 
    6773}