Development

Changeset 7131

You must first sign up to be able to contribute.

Changeset 7131

Show
Ignore:
Timestamp:
01/21/08 15:48:28 (1 year ago)
Author:
fabien
Message:

merged 1.1 branch changes (to r7127)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LICENSE

    r355 r7131  
    1 Copyright (c) 2004-2006 Fabien Potencier 
     1Copyright (c) 2004-2008 Fabien Potencier 
    22 
    3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 
     3Permission is hereby granted, free of charge, to any person obtaining a copy 
     4of this software and associated documentation files (the "Software"), to deal 
     5in the Software without restriction, including without limitation the rights 
     6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     7copies of the Software, and to permit persons to whom the Software is furnished 
     8to do so, subject to the following conditions: 
    49 
    5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 
     10The above copyright notice and this permission notice shall be included in all 
     11copies or substantial portions of the Software. 
    612 
    7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
     13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     19THE SOFTWARE. 
  • trunk/UPGRADE

    r6779 r7131  
    388388        param: 
    389389          timeout:     1800     # session timeout in seconds 
     390 
     391`php.yml` configuration file 
     392---------------------------- 
     393 
     394The `php.yml` configuration file has been removed. 
     395 
     396The only setting you will have to check by hand is `log_errors`, which was set to `on` by `php.yml`. 
     397 
     398`php.yml` is replaced by the `check_configuration.php` utility you can find in `data/bin`. 
     399It checks your environment against symfony requirements. You can launch it from anywhere: 
     400 
     401   $ php /path/to/symfony/data/bin/check_configuration.php 
     402 
     403Even if you can use this utility from the command line, it's strongly recommended to launch it 
     404from the web by copying it under your web root directory as PHP can use different php.ini configuration 
     405files for the CLI and the web. 
  • trunk/data/bin/symfony.bat

    r3129 r7131  
    2121 
    2222IF EXIST ".\symfony" ( 
    23   %PHP_COMMAND% -d html_errors=off -d open_basedir= -q ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 
     23  %PHP_COMMAND% ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 
    2424) ELSE ( 
    25   %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 
     25  %PHP_COMMAND% "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 
    2626) 
    2727goto cleanup 
  • trunk/data/config/config_handlers.yml

    r5384 r7131  
    11config/autoload.yml: 
    22  class:    sfAutoloadConfigHandler 
    3  
    4 config/php.yml: 
    5   class:    sfPhpConfigHandler 
    63 
    74config/databases.yml: 
     
    3027  class:    sfRoutingConfigHandler 
    3128 
    32 config/i18n.yml: 
    33   class:    sfDefineEnvironmentConfigHandler 
    34   param: 
    35     prefix: sf_i18n_ 
    36  
    3729modules/*/config/generator.yml: 
    3830  class:    sfGeneratorConfigHandler 
     
    4032modules/*/config/view.yml: 
    4133  class:    sfViewConfigHandler 
    42  
    43 modules/*/config/mailer.yml: 
    44   class:    sfDefineEnvironmentConfigHandler 
    45   param: 
    46     prefix: sf_mailer_ 
    47     module: yes 
    4834 
    4935modules/*/config/security.yml: 
  • trunk/data/skeleton/module/test/actionsTest.php

    r6224 r7131  
    55// create a new test browser 
    66$browser = new sfTestBrowser(); 
    7 $browser->initialize(); 
    87 
    98$browser-> 
  • trunk/data/skeleton/project/web/.htaccess

    r3246 r7131  
    99 
    1010  # we skip all files with .something 
    11   RewriteCond %{REQUEST_URI} \..+$ 
    12   RewriteCond %{REQUEST_URI} !\.html$ 
    13   RewriteRule .* - [L] 
     11  #RewriteCond %{REQUEST_URI} \..+$ 
     12  #RewriteCond %{REQUEST_URI} !\.html$ 
     13  #RewriteRule .* - [L] 
    1414 
    1515  # we check if the .html version is here (caching) 
  • trunk/lib/action/sfComponent.class.php

    r6509 r7131  
    237237   * Sets a variable for the template. 
    238238   * 
    239    * @param  string The variable name 
    240    * @param  mixed  The variable value 
    241    */ 
    242   public function setVar($name, $value) 
    243   { 
    244     $this->varHolder->set($name, $value); 
     239   * If you add a safe value, the variable won't be output escaped 
     240   * by symfony, so this is your responsability to ensure that the 
     241   * value is escaped properly. 
     242   * 
     243   * @param string  The variable name 
     244   * @param mixed   The variable value 
     245   * @param Boolean true if the value is safe for output (false by default) 
     246   */ 
     247  public function setVar($name, $value, $safe = false) 
     248  { 
     249    $this->varHolder->set($name, $safe ? new sfOutputEscaperSafe($value) : $value); 
    245250  } 
    246251 
  • trunk/lib/config/sfDatabaseConfigHandler.class.php

    r6779 r7131  
    5050 
    5151    // get a list of database connections 
    52     foreach ($myConfig as $key => $dbConfig) 
     52    foreach ($myConfig as $name => $dbConfig) 
    5353    { 
    5454      // is this category already registered? 
    55       if (in_array($key, $databases)) 
     55      if (in_array($name, $databases)) 
    5656      { 
    5757        // this category is already registered 
    58         throw new sfParseException(sprintf('Configuration file "%s" specifies previously registered category "%s".', $configFiles[0], $key)); 
     58        throw new sfParseException(sprintf('Configuration file "%s" specifies previously registered category "%s".', $configFiles[0], $name)); 
    5959      } 
    6060 
    6161      // add this database 
    62       $databases[] = $key
     62      $databases[] = $name
    6363 
    6464      // let's do our fancy work 
     
    6666      { 
    6767        // missing class key 
    68         throw new sfParseException(sprintf('Configuration file "%s" specifies category "%s" with missing class key.', $configFiles[0], $key)); 
     68        throw new sfParseException(sprintf('Configuration file "%s" specifies category "%s" with missing class key.', $configFiles[0], $name)); 
    6969      } 
    7070 
     
    7272      { 
    7373        // we have a file to include 
    74         $file = $this->replaceConstants($dbConfig['file']); 
    75         $file = $this->replacePath($file); 
     74        $file = $this->replacePath($this->replaceConstants($dbConfig['file'])); 
    7675 
    7776        if (!is_readable($file)) 
     
    8685 
    8786      // parse parameters 
     87      $parameters = array(); 
    8888      if (isset($dbConfig['param'])) 
    8989      { 
    90         foreach ($dbConfig['param'] as &$value) 
     90        foreach ($dbConfig['param'] as $key => $value) 
    9191        { 
    92           $value = $this->replaceConstants($value); 
     92          $parameters[$key] = $this->replaceConstants($value); 
    9393        } 
    94  
    95         $parameters = var_export($dbConfig['param'], true); 
    9694      } 
    97       else 
    98       { 
    99         $parameters = 'null'; 
    100       } 
     95      $parameters['name'] = $name; 
    10196 
    10297      // append new data 
    103       $data[] = sprintf("\n\$database = new %s(%s, '%s');\n". 
    104                         "\$this->databases['%s'] = \$database;", 
    105                         $dbConfig['class'], $parameters, $key, $key); 
     98      $data[] = sprintf("\n\$this->databases['%s'] = new %s(%s);", $name, $dbConfig['class'], var_export($parameters, true)); 
    10699    } 
    107100 
    108101    // compile data 
    109     $retval = sprintf("<?php\n". 
     102    return sprintf("<?php\n". 
    110103                      "// auto-generated by sfDatabaseConfigHandler\n". 
    111104                      "// date: %s%s\n%s\n", 
    112105                      date('Y/m/d H:i:s'), implode("\n", $includes), implode("\n", $data)); 
    113  
    114     return $retval; 
    115106  } 
    116107} 
  • trunk/lib/config/sfLoader.class.php

    r6779 r7131  
    414414  } 
    415415 
     416  /** 
     417   * Loads config.php files from plugins 
     418   * 
     419   * @return void 
     420   */ 
    416421  static public function loadPluginConfig() 
    417422  { 
    418423    if ($pluginConfigs = glob(sfConfig::get('sf_symfony_lib_dir').'/plugins/*/config/config.php')) 
    419424    { 
     425      foreach($pluginConfigs as $config) 
     426      { 
     427        require_once($config); 
     428      } 
     429    } 
     430 
     431    if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir').'/*/config/config.php')) 
     432    { 
    420433      foreach ($pluginConfigs as $config) 
    421434      { 
    422         include($config); 
    423       } 
    424     } 
    425  
    426     if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir').'/*/config/config.php')) 
    427     { 
    428       foreach ($pluginConfigs as $config) 
    429       { 
    430         include($config); 
     435        require_once($config); 
    431436      } 
    432437    } 
  • trunk/lib/controller/sfController.class.php

    r6779 r7131  
    205205      } 
    206206 
    207       // track the requested module so we have access to the data in the error 404 page 
    208       $this->context->getRequest()->setAttribute('requested_action', $actionName); 
    209       $this->context->getRequest()->setAttribute('requested_module', $moduleName); 
    210  
    211       // switch to error 404 action 
    212       $moduleName = sfConfig::get('sf_error_404_module'); 
    213       $actionName = sfConfig::get('sf_error_404_action'); 
    214  
    215       if (!$this->actionExists($moduleName, $actionName)) 
    216       { 
    217         // cannot find unavailable module/action 
    218         throw new sfConfigurationException(sprintf('Invalid configuration settings: [sf_error_404_module] "%s", [sf_error_404_action] "%s".', $moduleName, $actionName)); 
    219       } 
     207      throw new sfError404Exception(sprintf('Action "%s/%s" does not exist.', $moduleName, $actionName)); 
    220208    } 
    221209 
  • trunk/lib/exception/sfError404Exception.class.php

    r6522 r7131  
    2020{ 
    2121  /** 
    22    * @see sfException 
     22   * Forwards to the 404 action. 
    2323   */ 
    24   public function asResponse() 
     24  public function printStackTrace() 
    2525  { 
     26    // log all exceptions in php log 
     27    $exception = is_null($this->wrappedException) ? $this : $this->wrappedException; 
     28    error_log($exception->getMessage()); 
     29 
    2630    if (sfConfig::get('sf_debug')) 
    2731    { 
    28       $response = parent::asResponse(); 
    29       $response->setStatusCode(404); 
     32      sfContext::getInstance()->getResponse()->setStatusCode(404); 
     33 
     34      return parent::printStackTrace(); 
    3035    } 
    3136    else 
     
    3742      } 
    3843 
    39       $context = sfContext::getInstance(); 
    40       $context->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 
    41       $response = $context->getResponse(); 
     44      sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 
    4245    } 
    43  
    44     return $response; 
    4546  } 
    4647} 
  • trunk/lib/filter/sfBasicSecurityFilter.class.php

    r6522 r7131  
    3030  public function execute($filterChain) 
    3131  { 
    32     // get the cool stuff 
    33     $controller = $this->context->getController(); 
    34     $user       = $this->context->getUser(); 
    35  
    36     // get the current action instance 
    37     $actionEntry    = $controller->getActionStack()->getLastEntry(); 
    38     $actionInstance = $actionEntry->getActionInstance(); 
    39  
    40     // disable security on [sf_login_module] / [sf_login_action] 
     32    // disable security on login and secure actions 
    4133    if ( 
    4234      (sfConfig::get('sf_login_module') == $this->context->getModuleName()) && (sfConfig::get('sf_login_action') == $this->context->getActionName()) 
     
    5042    } 
    5143 
    52     // get the credential required for this action 
    53     $credential = $actionInstance->getCredential(); 
    54  
    55     // for this filter, the credentials are a simple privilege array 
    56     // where the first index is the privilege name and the second index 
    57     // is the privilege namespace 
    58     // 
    5944    // NOTE: the nice thing about the Action class is that getCredential() 
    6045    //       is vague enough to describe any level of security and can be 
    6146    //       used to retrieve such data and should never have to be altered 
    62     if ($user->isAuthenticated()) 
    63     { 
    64       // the user is authenticated 
    65       if ($credential === null || $user->hasCredential($credential)) 
    66       { 
    67         // the user has access, continue 
    68         $filterChain->execute(); 
    69       } 
    70       else 
    71       { 
    72         // the user doesn't have access, exit stage left 
    73         $controller->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); 
    74  
    75         throw new sfStopException(); 
    76       } 
    77     } 
    78     else 
     47    if (!$this->context->getUser()->isAuthenticated()) 
    7948    { 
    8049      // the user is not authenticated 
    81       $controller->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')); 
     50      $this->forwardToLoginAction(); 
     51    } 
    8252 
    83       throw new sfStopException(); 
     53    // the user is authenticated 
     54    $credential = $this->getUserCredential(); 
     55    if (!is_null($credential) && !$this->context->getUser()->hasCredential($credential)) 
     56    { 
     57      // the user doesn't have access 
     58      $this->forwardToSecureAction(); 
    8459    } 
     60 
     61    // the user has access, continue 
     62    $filterChain->execute(); 
     63  } 
     64 
     65  /** 
     66   * Forwards the current request to the secure action. 
     67   * 
     68   * @throws sfStopException 
     69   */ 
     70  protected function forwardToSecureAction() 
     71  { 
     72    $this->context->getController()->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); 
     73 
     74    throw new sfStopException(); 
     75  } 
     76 
     77  /** 
     78   * Forwards the current request to the login action. 
     79   * 
     80   * @throws sfStopException 
     81   */ 
     82  protected function forwardToLoginAction() 
     83  { 
     84    $this->context->getController()->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')); 
     85 
     86    throw new sfStopException(); 
     87  } 
     88 
     89  /** 
     90   * Returns the credential required for this action. 
     91   * 
     92   * @return mixed The credential required for this action 
     93   */ 
     94  protected function getUserCredential() 
     95  { 
     96    return $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance()->getCredential(); 
    8597  } 
    8698} 
  • trunk/lib/form/sfForm.class.php

    r6779 r7131  
    114114   * @param array An array of uploaded files (in the $_FILES or $_GET format) 
    115115   */ 
    116   public function bind($taintedValues, $taintedFiles = array()) 
     116  public function bind(array $taintedValues = null, array $taintedFiles = array()) 
    117117  { 
    118118    $this->taintedValues = $taintedValues; 
     
    121121    $this->resetFormFields(); 
    122122 
     123    if (is_null($this->taintedValues)) 
     124    { 
     125      $this->taintedValues = array(); 
     126    } 
     127 
    123128    try 
    124129    { 
    125       $this->values = $this->validatorSchema->clean(array_merge($this->taintedValues, self::convertFileInformation($this->taintedFiles))); 
     130      $this->values = $this->validatorSchema->clean($this->taintedValues + self::convertFileInformation($this->taintedFiles)); 
    126131      $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); 
    127132 
     
    203208   * @param string The field name 
    204209   * @param sfForm A sfForm instance 
    205    * @param string The format to use for widget name 
    206210   * @param string A HTML decorator for the embedded form 
    207211   */ 
    208   public function embedForm($name, sfForm $form, $nameFormat = null, $decorator = null) 
    209   { 
    210     // change the name format for the embedded widget 
    211     if (is_null($nameFormat)) 
    212     { 
    213       $nameFormat = $this->generateNameFormatForEmbedded($name, $this->widgetSchema->getNameFormat()); 
    214     } 
    215  
     212  public function embedForm($name, sfForm $form, $decorator = null) 
     213  { 
    216214    $form = clone $form; 
    217215    unset($form[self::$CSRFFieldName]); 
    218216 
    219217    $widgetSchema = $form->getWidgetSchema(); 
    220     $widgetSchema->setNameFormat($nameFormat); 
    221218 
    222219    $this->setDefault($name, $form->getDefaults()); 
     
    235232   * @param string  The field name 
    236233   * @param sfForm  A sfForm instance 
    237    * @param integer The number of times to include the form 
    238    * @param string  The format to use for widget name 
     234   * @param integer The number of times to embed the form 
    239235   * @param string  A HTML decorator for the main form around embedded forms 
    240236   * @param string  A HTML decorator for each embedded form 
    241237   */ 
    242   public function embedFormForEach($name, sfForm $form, $n, $nameFormat = null, $decorator = null, $innerDecorator = null, $attributes = array(), $options = array(), $labels = array()) 
    243   { 
    244     // change the name format for the embedded widget 
    245     if (is_null($nameFormat)) 
    246     { 
    247       $nameFormat = $this->generateNameFormatForEmbedded($name, $this->widgetSchema->getNameFormat()); 
    248     } 
    249  
     238  public function embedFormForEach($name, sfForm $form, $n, $decorator = null, $innerDecorator = null, $attributes = array(), $options = array(), $labels = array()) 
     239  { 
    250240    $form = clone $form; 
    251241    unset($form[self::$CSRFFieldName]); 
     242 
     243    $widgetSchema = $form->getWidgetSchema(); 
    252244 
    253245    // generate labels and default values 
     
    257249      if (!isset($labels[$i])) 
    258250      { 
    259         $labels[$i] = sprintf('%s (%s)', $form->getWidgetSchema()->generateLabelName($name), $i); 
     251        $labels[$i] = sprintf('%s (%s)', $widgetSchema->generateLabelName($name), $i); 
    260252      } 
    261253 
     
    265257    $this->setDefault($name, $defaults); 
    266258 
    267     $decorator = is_null($decorator) ? $form->getWidgetSchema()->getFormFormatter()->getDecoratorFormat() : $decorator; 
    268     $innerDecorator = is_null($innerDecorator) ? $form->getWidgetSchema()->getFormFormatter()->getDecoratorFormat() : $innerDecorator; 
    269  
    270     $this->widgetSchema[$name] = new sfWidgetFormSchemaDecorator(new sfWidgetFormSchemaForEach($nameFormat, new sfWidgetFormSchemaDecorator($form->getWidgetSchema(), $innerDecorator), $n, $attributes, $options, $labels), $decorator); 
     259    $decorator = is_null($decorator) ? $widgetSchema->getFormFormatter()->getDecoratorFormat() : $decorator; 
     260    $innerDecorator = is_null($innerDecorator) ? $widgetSchema->getFormFormatter()->getDecoratorFormat() : $innerDecorator; 
     261 
     262    $this->widgetSchema[$name] = new sfWidgetFormSchemaDecorator(new sfWidgetFormSchemaForEach(new sfWidgetFormSchemaDecorator($widgetSchema, $innerDecorator), $n, $attributes, $options, $labels), $decorator); 
    271263    $this->validatorSchema[$name] = new sfValidatorSchemaForEach($form->getValidatorSchema(), $n); 
    272264 
     
    275267 
    276268  /** 
     269   * Sets the validators associated with this form. 
     270   * 
     271   * @param array An array of named validators 
     272   */ 
     273  public function setValidators(array $validators) 
     274  { 
     275    $this->setValidatorSchema(new sfValidatorSchema($validators)); 
     276  } 
     277 
     278  /** 
    277279   * Sets the validator schema associated with this form. 
    278280   * 
     
    294296  { 
    295297    return $this->validatorSchema; 
     298  } 
     299 
     300  /** 
     301   * Sets the widgets associated with this form. 
     302   * 
     303   * @param array An array of named widgets 
     304   */ 
     305  public function setWidgets(array $widgets) 
     306  { 
     307    $this->setWidgetSchema(new sfWidgetFormSchema($widgets)); 
    296308  } 
    297309 
     
    389401  { 
    390402    $this->defaults = $defaults; 
     403 
     404    if (self::$CSRFProtection) 
     405    { 
     406      $this->setDefault(self::$CSRFFieldName, $this->getCSRFToken(self::$CSRFSecret)); 
     407    } 
    391408 
    392409    $this->resetFormFields(); 
     
    548565      $values = $this->isBound ? $this->taintedValues : $this->defaults; 
    549566 
    550       $this->formFields[$name] = new sfFormField($widget, $this->getFormField(), $name, isset($values[$name]) ? $values[$name] : null, $this->errorSchema[$name]); 
     567      $class = $widget instanceof sfWidgetFormSchema ? 'sfFormFieldSchema' : 'sfFormField'; 
     568 
     569      $this->formFields[$name] = new $class($widget, $this->getFormField(), $name, isset($values[$name]) ? $values[$name] : null, $this->errorSchema[$name]); 
    551570    } 
    552571 
     
    584603   * Returns a form field for the main widget schema. 
    585604   * 
    586    * @return sfFormField A sfFormField instance 
     605   * @return sfFormFieldSchema A sfFormFieldSchema instance 
    587606   */ 
    588607  protected function getFormField() 
     
    590609    if (is_null($this->formField)) 
    591610    { 
    592       $this->formField = new sfFormField($this->widgetSchema, null, null, $this->isBound ? $this->taintedValues : $this->defaults, $this->errorSchema); 
     611      $this->formField = new sfFormFieldSchema($this->widgetSchema, null, null, $this->isBound ? $this->taintedValues : $this->defaults, $this->errorSchema); 
    593612    } 
    594613 
     
    597616 
    598617  /** 
    599    * Generates a name format for embedded forms. 
    600    * 
    601    * @param  string The widget name 
    602    * @param  string The current name format 
    603    * 
    604    * @return string The name format to use for embedding 
    605    * 
    606    * @see embedFormForEach() 
    607    * @see embedForm() 
    608    */ 
    609   protected function generateNameFormatForEmbedded($name, $nameFormat) 
    610   { 
    611     // if current name format is something[%s], change it to something[$name][%s] 
    612     // else change it to $name[%s] 
    613     if ('[%s]' === substr($nameFormat, -4)) 
    614     { 
    615       return sprintf('%s[%s][%%s]', substr($nameFormat, 0, -4), $name); 
    616     } 
    617     else 
    618     { 
    619       return sprintf('%s[%%s]', $name); 
    620     } 
    621   } 
    622  
    623   /** 
    624618   * Converts uploaded file array to a format following the $_GET and $POST naming convention. 
    625619   * 
     
    630624   * @return array An array of re-ordered uploaded file information 
    631625   */ 
    632   static public function convertFileInformation($taintedFiles) 
     626  static public function convertFileInformation(array $taintedFiles) 
    633627  { 
    634628    return self::pathsToArray(preg_replace('#^(/[^/]+)?(/name|/type|/tmp_name|/error|/size)([^\s]*)( = [^\n]*)#m', '$1$3$2$4', self::arrayToPaths($taintedFiles))); 
     
    708702    return $str; 
    709703  } 
     704 
     705  public function __clone() 
     706  { 
     707    $this->widgetSchema    = clone $this->widgetSchema; 
     708    $this->validatorSchema = clone $this->validatorSchema; 
     709 
     710    // we rebind the cloned form because Exceptions are not clonable 
     711    $this->bind($this->taintedValues, $this->taintedFiles); 
     712  } 
    710713} 
  • trunk/lib/form/sfFormField.class.php

    r6196 r7131  
    1717 * @version    SVN: $Id$ 
    1818 */ 
    19 class sfFormField implements ArrayAccess 
     19class sfFormField 
    2020{ 
    2121  protected 
     
    2424    $name   = '', 
    2525    $value  = null, 
    26     $error  = null, 
    27     $fields = array(); 
     26    $error  = null; 
    2827 
    2928  /** 
    3029   * Constructor. 
    3130   * 
    32    * @param sfWidget         A sfWidget instance 
     31   * @param sfWidgetForm     A sfWidget instance 
    3332   * @param sfFormField      The sfFormField parent instance (null for the root widget) 
    3433   * @param string           The field name 
     
    3635   * @param sfValidatorError A sfValidatorError instance 
    3736   */ 
    38   public function __construct(sfWidget $widget, sfFormField $parent = null, $name, $value, sfValidatorError $error = null) 
     37  public function __construct(sfWidgetForm $widget, sfFormField $parent = null, $name, $value, sfValidatorError $error = null) 
    3938  { 
    4039    $this->widget = $widget; 
     
    8079  public function renderRow($help = '') 
    8180  { 
    82     if ($this->widget instanceof sfWidgetFormSchema
    83     { 
    84       throw new LogicException('Unable to format a row on a sfWidgetFormSchema.'); 
     81    if (is_null($this->parent)
     82    { 
     83      throw new LogicException(sprintf('Unable to render the row for "%s".', $this->name)); 
    8584    } 
    8685 
    8786    $field = $this->parent->getWidget()->renderField($this->name, $this->value, $this->error); 
    8887 
    89     return strtr($this->parent->getWidget()->getFormFormatter()->formatRow($this->renderLabel(), $field, $this->error, $help), array('%hidden_fields%' => '')); 
     88    $error = $this->error instanceof sfValidatorErrorSchema ? $this->error->getGlobalErrors() : $this->error; 
     89 
     90    return strtr($this->parent->getWidget()->getFormFormatter()->formatRow($this->renderLabel(), $field, $error, $help), array('%hidden_fields%' => '')); 
    9091  } 
    9192 
     
    9596   * The formatted list will use the parent widget schema formatter. 
    9697   * 
    97    * @param  string The widget name 
    98    * 
    9998   * @return string The formatted error list 
    10099   */ 
    101100  public function renderError() 
    102101  { 
    103     if ($this->widget instanceof sfWidgetFormSchema) 
    104     { 
    105       throw new LogicException('Unable to format an error list on a sfWidgetFormSchema.'); 
    106     } 
    107  
    108     return $this->parent->getWidget()->getFormFormatter()->formatErrorsForRow($this->error); 
     102    if (is_null($this->parent)) 
     103    { 
     104      throw new LogicException(sprintf('Unable to render the error for "%s".', $this->name)); 
     105    } 
     106 
     107    $error = $this->error instanceof sfValidatorErrorSchema ? $this->error->getGlobalErrors() : $this->error; 
     108 
     109    return $this->parent->getWidget()->getFormFormatter()->formatErrorsForRow($error); 
    109110  } 
    110111 
     
    116117  public function renderLabel() 
    117118  { 
    118     if ($this->widget instanceof sfWidgetFormSchema
    119     { 
    120       throw new LogicException('Unable to render a label on a sfWidgetFormSchema.'); 
     119    if (is_null($this->parent)
     120    { 
     121      throw new LogicException(sprintf('Unable to render the label for "%s".', $this->name)); 
    121122    } 
    122123 
     
    131132  public function renderLabelName() 
    132133  { 
    133     if ($this->widget instanceof sfWidgetFormSchema
    134     { 
    135       throw new LogicException('Unable to render a label name on a sfWidgetFormSchema.'); 
     134    if (is_null($this->parent)
     135    { 
     136      throw new LogicException(sprintf('Unable to render the label name for "%s".', $this->name)); 
    136137    } 
    137138 
     
    198199    return !is_null($this->error) && count($this->error); 
    199200  } 
    200  
    201   /** 
    202    * Returns true if the bound field exists (implements the ArrayAccess interface). 
    203    * 
    204    * @param  string  The name of the bound field 
    205    * 
    206    * @return Boolean true if the widget exists, false otherwise 
    207    */ 
    208   public function offsetExists($name) 
    209   { 
    210     return $this->widget instanceof sfWidgetFormSchema ? isset($this->widget[$name]) : false; 
    211   } 
    212  
    213   /** 
    214    * Returns the form field associated with the name (implements the ArrayAccess interface). 
    215    * 
    216    * @param  string      The offset of the value to get 
    217    * 
    218    * @return sfFormField A form field instance 
    219    */ 
    220   public function offsetGet($name) 
    221   { 
    222     if (!isset($this->fields[$name])) 
    223     { 
    224       if (!$this->widget instanceof sfWidgetFormSchema) 
    225       { 
    226         throw new LogicException(sprintf('Cannot get a form field on a non widget schema (%s given).', get_class($this->widget))); 
    227       } 
    228  
    229       if (is_null($widget = $this->widget[$name])) 
    230       { 
    231         throw new InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name)); 
    232       } 
    233  
    234       $this->fields[$name] = new sfFormField($widget, $this, $name, isset($this->value[$name]) ? $this->value[$name] : null, isset($this->error[$name]) ? $this->error[$name] : null); 
    235     } 
    236  
    237     return $this->fields[$name]; 
    238   } 
    239  
    240   /** 
    241    * Throws an exception saying that values cannot be set (implements the ArrayAccess interface). 
    242    * 
    243    * @param string (ignored) 
    244    * @param string (ignored) 
    245    * 
    246    * @throws <b>LogicException</b> 
    247    */ 
    248   public function offsetSet($offset, $value) 
    249   { 
    250     throw new LogicException('Cannot update form fields (read-only).'); 
    251   } 
    252  
    253   /** 
    254    * Throws an exception saying that values cannot be unset (implements the ArrayAccess interface). 
    255    * 
    256    * @param string (ignored) 
    257    * 
    258    * @throws LogicException 
    259    */ 
    260   public function offsetUnset($offset) 
    261   { 
    262     throw new LogicException('Cannot remove form fields (read-only).'); 
    263   } 
    264201} 
  • trunk/lib/generator/sfAdminGenerator.class.php

    r5102 r7131  
    709709  } 
    710710 
     711  public function getFormObject() 
     712  { 
     713    $class = $this->getClassName().'Form'; 
     714 
     715    return new $class(); 
     716  } 
     717 
     718  public function getHiddenFields() 
     719  { 
     720    $form = $this->getFormObject(); 
     721    $hiddenFields = array(); 
     722    foreach ($form->getWidgetSchema()->getPositions() as $name) 
     723    { 
     724      if ($form[$name]->isHidden()) 
     725      { 
     726        $hiddenFields[] = $name; 
     727      } 
     728    } 
     729 
     730    return $hiddenFields; 
     731  } 
     732 
     733  public function getHiddenFieldsAsString() 
     734  { 
     735    $hiddenFields = ''; 
     736    foreach ($this->getHiddenFields() as $name) 
     737    { 
     738      $hiddenFields .= '        [?php echo $form[\''.$name.'\'] ?]'."\n"; 
     739    } 
     740 
     741    return "\n".$hiddenFields; 
     742  } 
     743 
     744  public function getLastNonHiddenField() 
     745  { 
     746    $form = $this->getFormObject(); 
     747    $positions = $form->getWidgetSchema()->getPositions(); 
     748    $last = count($positions) - 1; 
     749    for ($i = count($positions) - 1; $i >= 0; $i--) 
     750    { 
     751      if ($form[$positions[$i]]->isHidden()) 
     752      { 
     753        $last = $i - 1; 
     754      } 
     755      else 
     756      { 
     757        break; 
     758      } 
     759    } 
     760 
     761    return $last; 
     762  } 
     763 
    711764  /** 
    712765   * Escapes a string. 
  • trunk/lib/generator/sfCrudGenerator.class.php

    r5098 r7131  
    9696   * @return string The PHP code 
    9797   */ 
    98   public function getRetrieveByPkParamsForAction($indent
     98  public function getRetrieveByPkParamsForAction($indent, $callee = '$this->getRequestParameter'
    9999  { 
    100100    $params = array(); 
    101101    foreach ($this->getPrimaryKey() as $pk) 
    102102    { 
    103       $params[] = "\$this->getRequestParameter('".sfInflector::underscore($pk->getPhpName())."')"; 
     103      $params[] = "$callee('".sfInflector::underscore($pk->getPhpName())."')"; 
     104    } 
     105 
     106    return implode(",\n".str_repeat(' ', max(0, $indent - strlen($this->singularName.$this->className))), $params); 
     107  } 
     108 
     109  /** 
     110   * Returns PHP code for primary keys parameters. 
     111   * 
     112   * @param integer The indentation value 
     113   * 
     114   * @return string The PHP code 
     115   */ 
     116  public function getRetrieveByPkParamsForEdit($indent, $prefix) 
     117  { 
     118    $params = array(); 
     119    foreach ($this->getPrimaryKey() as $pk) 
     120    { 
     121      $name = sfInflector::underscore($pk->getPhpName()); 
     122//      $params[] = sprintf("\$request->getParameter('%s', \$request->getParameter('%s'))", sprintf('%s[%s]', $prefix, $name), $name); 
     123      $params[] = sprintf("\$request->getParameter('%s')", $name); 
    104124    } 
    105125 
  • trunk/lib/i18n/sfChoiceFormat.class.php

    r4341 r7131  
    5353 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    5454 * @version v1.0, last update on Fri Dec 24 20:46:16 EST 2004 
    55  * @package System.I18N.core 
     55 * @package    symfony 
     56 * @subpackage i18n 
    5657 */ 
    5758class sfChoiceFormat 
  • trunk/lib/i18n/sfCultureInfo.class.php

    r6376 r7131  
    4747 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    4848 * @version v1.0, last update on Sat Dec 04 13:41:46 EST 2004 
    49  * @package System.I18N.core 
     49 * @package    symfony 
     50 * @subpackage i18n 
    5051 */ 
    5152class sfCultureInfo 
  • trunk/lib/i18n/sfDateFormat.class.php

    r4343 r7131  
    3535 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    3636 * @version v1.0, last update on Sat Dec 04 14:10:49 EST 2004 
    37  * @package System.I18N.core 
     37 * @package    symfony 
     38 * @subpackage i18n 
    3839 */ 
    3940class sfDateFormat 
  • trunk/lib/i18n/sfDateTimeFormatInfo.class.php

    r5773 r7131  
    6969 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    7070 * @version v1.0, last update on Fri Dec 03 22:30:31 EST 2004 
    71  * @package System.I18N.core 
     71 * @package    symfony 
     72 * @subpackage i18n 
    7273 */ 
    7374class sfDateTimeFormatInfo 
  • trunk/lib/i18n/sfIMessageSource.class.php

    r4580 r7131  
    2929 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    3030 * @version v1.0, last update on Fri Dec 24 17:40:19 EST 2004 
    31  * @package System.I18N.core 
     31 * @package    symfony 
     32 * @subpackage i18n 
    3233 */ 
    3334interface sfIMessageSource 
  • trunk/lib/i18n/sfMessageFormat.class.php

    r4576 r7131  
    4141 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    4242 * @version v1.0, last update on Fri Dec 24 20:46:16 EST 2004 
    43  * @package System.I18N.core 
     43 * @package    symfony 
     44 * @subpackage i18n 
    4445 */ 
    4546class sfMessageFormat 
  • trunk/lib/i18n/sfMessageSource.class.php

    r4590 r7131  
    5959 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    6060 * @version v1.0, last update on Fri Dec 24 19:55:49 EST 2004 
    61  * @package System.I18N.core 
     61 * @package    symfony 
     62 * @subpackage i18n 
    6263 */ 
    6364abstract class sfMessageSource implements sfIMessageSource 
  • trunk/lib/i18n/sfMessageSource_Database.class.php

    r4580 r7131  
    2626 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    2727 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 
    28  * @package System.I18N.core 
     28 * @package    symfony 
     29 * @subpackage i18n 
    2930 */ 
    3031abstract class sfMessageSource_Database extends sfMessageSource 
  • trunk/lib/i18n/sfMessageSource_File.class.php

    r4580 r7131  
    2626 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    2727 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 
    28  * @package System.I18N.core 
     28 * @package    symfony 
     29 * @subpackage i18n 
    2930 */ 
    3031abstract class sfMessageSource_File extends sfMessageSource 
  • trunk/lib/i18n/sfMessageSource_MySQL.class.php

    r5770 r7131  
    8787 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    8888 * @version v1.0, last update on Fri Dec 24 16:58:58 EST 2004 
    89  * @package System.I18N.core 
     89 * @package    symfony 
     90 * @subpackage i18n 
    9091 */ 
    9192class sfMessageSource_MySQL extends sfMessageSource_Database 
  • trunk/lib/i18n/sfMessageSource_SQLite.class.php

    r4590 r7131  
    8383 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    8484 * @version v1.0, last update on Fri Dec 24 16:58:58 EST 2004 
    85  * @package System.I18N.core 
     85 * @package    symfony 
     86 * @subpackage i18n 
    8687 */ 
    8788class sfMessageSource_SQLite extends sfMessageSource_Database 
  • trunk/lib/i18n/sfMessageSource_XLIFF.class.php

    r4590 r7131  
    3232 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    3333 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 
    34  * @package System.I18N.core 
     34 * @package    symfony 
     35 * @subpackage i18n 
    3536 */ 
    3637class sfMessageSource_XLIFF extends sfMessageSource_File 
  • trunk/lib/i18n/sfMessageSource_gettext.class.php

    r4590 r7131  
    2929 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    3030 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 
    31  * @package System.I18N.core 
     31 * @package    symfony 
     32 * @subpackage i18n 
    3233 */ 
    3334class sfMessageSource_gettext extends sfMessageSource_File 
  • trunk/lib/i18n/sfNumberFormat.class.php

    r5773 r7131  
    5959 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    6060 * @version v1.0, last update on Fri Dec 10 18:10:20 EST 2004 
    61  * @package System.I18N.core 
     61 * @package    symfony 
     62 * @subpackage i18n 
    6263 */ 
    6364class sfNumberFormat 
  • trunk/lib/i18n/sfNumberFormatInfo.class.php

    r5773 r7131  
    4040 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 
    4141 * @version v1.0, last update on Sun Dec 05 14:48:26 EST 2004 
    42  * @package System.I18N.core 
     42 * @package    symfony 
     43 * @subpackage i18n 
    4344 */ 
    4445class sfNumberFormatInfo 
  • trunk/lib/log/sfWebDebugLogger.class.php

    r6591 r7131  
    44 * This file is part of the symfony package. 
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    3535  public function initialize(sfEventDispatcher $dispatcher, $options = array()) 
    3636  { 
    37     $this->webDebug   = new sfWebDebug(); 
    3837    $this->context    = sfContext::getInstance(); 
    3938    $this->dispatcher = $dispatcher; 
    4039 
    4140    $dispatcher->connect('response.filter_content', array($this, 'filterResponseContent')); 
     41 
     42    if(is_null($this->webDebug)) 
     43    { 
     44      $this->webDebug = $this->context->has('sf_web_debug') ? $this->context->get('sf_web_debug') : new sfWebDebug(); 
     45    } 
     46 
     47    $this->context->set('sf_web_debug', $this->webDebug); 
    4248 
    4349    if (isset($options['xdebug_logging'])) 
     
    9096 
    9197    // add needed assets for the web debug toolbar 
    92     $root = $this->context->getRequest()->getRelativeUrlRoot();  
     98    $root = $this->context->getRequest()->getRelativeUrlRoot(); 
    9399    $assets = sprintf(' 
    94100      <script type="text/javascript" src="%s"></script> 
     
    121127    // if we have xdebug and dev has not disabled the feature, add some stack information 
    122128    $debugStack = array(); 
    123     if (function_exists('xdebug_get_function_stack') && $this->xdebugLogging
     129    if ($this->xdebugLogging && function_exists('xdebug_get_function_stack')
    124130    { 
    125131      foreach (xdebug_get_function_stack() as $i => $stack) 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php

    r5102 r7131  
    106106    $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 
    107107 
    108     if ($this->getRequest()->getMethod() == sfRequest::POST
     108    if ($this->getRequest()->isMethod('post')
    109109    { 
    110110      $this->update<?php echo $this->getClassName() ?>FromRequest(); 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/skeleton/config/generator.yml

    r500 r7131  
    44    model_class:      ##MODEL_CLASS## 
    55    theme:            default 
     6 
     7##CONFIG## 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/actions/actions.class.php

    r4334 r7131  
    22 
    33/** 
    4  * <?php echo $this->getGeneratedModuleName() ?> actions. 
     4 * <?php echo $this->getModuleName() ?> actions. 
    55 * 
    66 * @package    ##PROJECT_NAME## 
    7  * @subpackage <?php echo $this->getGeneratedModuleName() ?> 
     7 * @subpackage <?php echo $this->getModuleName() ?> 
    88 
    99 * @author     ##AUTHOR_NAME## 
     
    1414  public function executeIndex() 
    1515  { 
    16     return $this->forward('<?php echo $this->getModuleName() ?>', 'list'); 
     16    $this-><?php echo $this->getSingularName() ?>List = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria()); 
    1717  } 
    1818 
    19   public function executeList() 
     19<?php if (isset($this->params['with_show']) && $this->params['with_show']): ?> 
     20  public function executeShow($request) 
    2021  { 
    21     $this-><?php echo $this->getPluralName() ?> = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria()); 
    22   } 
    23  
    24   public function executeShow() 
    25   { 
    26     $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>); 
     22    $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>); 
    2723    $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); 
    2824  } 
    2925 
     26<?php endif; ?> 
     27<?php if (isset($this->params['non_atomic_actions']) && $this->params['non_atomic_actions']): ?> 
     28  public function executeEdit($request) 
     29  { 
     30    $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForEdit(49, $this->getSingularName()) ?>)); 
     31 
     32    if ($request->isMethod('post')) 
     33    { 
     34      $this->form->bind($request->getParameter('<?php echo $this->getSingularName() ?>')); 
     35      if ($this->form->isValid()) 
     36      { 
     37        $<?php echo $this->getSingularName() ?> = $this->form->save(); 
     38 
     39        $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>); 
     40      } 
     41    } 
     42  } 
     43<?php else: ?> 
    3044  public function executeCreate() 
    3145  { 
    32     $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 
     46    $this->form = new <?php echo $this->getClassName() ?>Form(); 
    3347 
    3448    $this->setTemplate('edit'); 
    3549  } 
    3650 
    37   public function executeEdit(
     51  public function executeEdit($request
    3852  { 
    39     $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>); 
    40     $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); 
     53    $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>)); 
    4154  } 
    4255 
    43   public function executeUpdate(
     56  public function executeUpdate($request
    4457  { 
    45     if (<?php echo $this->getTestPksForGetOrCreate(false) ?>) 
     58    $this->forward404Unless($request->isMethod('post')); 
     59 
     60    $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>)); 
     61 
     62    $this->form->bind($this->getRequestParameter('<?php echo $this->getSingularName() ?>')); 
     63    if ($this->form->isValid()) 
    4664    { 
    47       $<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 
    48     } 
    49     else 
    50     { 
    51       $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(45) ?>); 
    52       $this->forward404Unless($<?php echo $this->getSingularName() ?>); 
     65      $<?php echo $this->getSingularName() ?> = $this->form->save(); 
     66 
     67      $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>); 
    5368    } 
    5469 
    55 <?php foreach ($this->getTableMap()->getColumns() as $name => $column): $type = $column->getCreoleType(); ?> 
    56 <?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?> 
    57 <?php $name = sfInflector::underscore($column->getPhpName()) ?> 
    58 <?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?> 
    59     if ($this->getRequestParameter('<?php echo $name ?>')) 
    60     { 
    61       list($d, $m, $y) = $this->getContext()->getI18N()->getDateForCulture($this->getRequestParameter('<?php echo $name ?>'), $this->getUser()->getCulture()); 
    62       $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>("$y-$m-$d"); 
    63     } 
    64 <?php elseif ($type == CreoleTypes::BOOLEAN): ?> 
    65     $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>', 0)); 
    66 <?php elseif ($column->isForeignKey()): ?> 
    67     $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>') ? $this->getRequestParameter('<?php echo $name ?>') : null); 
    68 <?php else: ?> 
    69     $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>')); 
     70    $this->setTemplate('edit'); 
     71  } 
    7072<?php endif; ?> 
    71 <?php endforeach; ?> 
    7273 
    73     $<?php echo $this->getSingularName() ?>->save(); 
    74  
    75     return $this->redirect('<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>); 
    76 <?php //' ?> 
    77   } 
    78  
    79   public function executeDelete() 
     74  public function executeDelete($request) 
    8075  { 
    81     $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>); 
    82  
    83     $this->forward404Unless($<?php echo $this->getSingularName() ?>); 
     76    $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>)); 
    8477 
    8578    $<?php echo $this->getSingularName() ?>->delete(); 
    8679 
    87     return $this->redirect('<?php echo $this->getModuleName() ?>/list'); 
     80    $this->redirect('<?php echo $this->getModuleName() ?>/index'); 
    8881  } 
    8982} 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/editSuccess.php

    r2726 r7131  
    1 [?php use_helper('Object') ?] 
     1<?php $form = $this->getFormObject() ?> 
     2[?php $<?php echo $this->getSingularName() ?> = $form->getObject() ?] 
     3<h1>[?php echo $<?php echo $this->getSingularName() ?>->isNew() ? 'New' : 'Edit' ?] <?php echo sfInflector::humanize($this->getModuleName()) ?></h1> 
    24 
    3 [?php echo form_tag('<?php echo $this->getModuleName() ?>/update') ?] 
     5<form action="[?php echo url_for('<?php echo $this->getModuleName() ?>/<?php echo isset($this->params['non_atomic_actions']) && $this->params['non_atomic_actions'] ? 'edit' : 'update' ?>'.(!$<?php echo $this->getSingularName() ?>->isNew() ? '?<?php echo $this->getPrimaryKeyUrlParams() ?> : '')) ?]" method="post" [?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?]> 
     6  <table> 
     7    <tfoot> 
     8      <tr> 
     9        <td colspan="2"> 
     10          &nbsp;<a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/index') ?]">Cancel</a> 
     11          [?php if (!$<?php echo $this->getSingularName() ?>->isNew()): ?] 
     12            &nbsp;[?php echo link_to('Delete', '<?php echo $this->getModuleName() ?>/delete?<?php echo $this->getPrimaryKeyUrlParams() ?>, array('post' => true, 'confirm' => 'Are you sure?')) ?] 
     13          [?php endif; ?] 
     14          <input type="submit" value="Save" /> 
     15        </td> 
     16      </tr> 
     17    </tfoot> 
     18    <tbody> 
     19<?php if (isset($this->params['non_verbose_templates']) && $this->params['non_verbose_templates']): ?> 
     20      [?php echo $form ?] 
     21<?php else: ?> 
    422 
    5 <?php foreach ($this->getPrimaryKey() as $pk): ?> 
    6 [?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?] 
     23<?php foreach ($form->getWidgetSchema()->getPositions() as $i => $name): ?> 
     24<?php if ($form[$name]->isHidden()) continue ?> 
     25      <tr> 
     26        <th><?php echo $form[$name]->renderLabel() ?></th> 
     27        <td> 
     28          [?php echo $form['<?php echo $name ?>']->renderError() ?] 
     29          [?php echo $form['<?php echo $name ?>'] ?] 
     30<?php $i == $this->getLastNonHiddenField() and print $this->getHiddenFieldsAsString() ?> 
     31        </td> 
     32      </tr> 
    733<?php endforeach; ?> 
    8  
    9 <table> 
    10 <tbody> 
    11 <?php foreach ($this->getTableMap()->getColumns() as $name => $column): ?> 
    12 <?php if ($column->isPrimaryKey()) continue ?> 
    13 <?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?> 
    14 <tr> 
    15   <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?><?php if ($column->isNotNull()): ?>*<?php endif; ?>:</th> 
    16   <td>[?php echo <?php echo $this->getCrudColumnEditTag($column) ?> ?]</td> 
    17 </tr> 
    18 <?php endforeach; ?> 
    19 </tbody> 
    20 </table> 
    21 <hr /> 
    22 [?php echo submit_tag('save') ?] 
    23 [?php if (<?php echo $this->getPrimaryKeyIsSet() ?>): ?] 
    24   &nbsp;[?php echo link_to('delete', '<?php echo $this->getModuleName() ?>/delete?<?php echo $this->getPrimaryKeyUrlParams() ?>, 'post=true&confirm=Are you sure?') ?] 
    25   &nbsp;[?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] 
    26 [?php else: ?] 
    27   &nbsp;[?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/list') ?] 
    28 [?php endif; ?] 
     34<?php endif; ?> 
     35    </tbody> 
     36  </table> 
    2937</form> 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/showSuccess.php

    r1228 r7131  
    11<table> 
    2 <tbody> 
     2  <tbody> 
    33<?php foreach ($this->getTableMap()->getColumns() as $column): ?> 
    4 <tr> 
    5 <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?>: </th> 
    6 <td>[?= $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td> 
    7 </tr> 
     4    <tr> 
     5      <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?>:</th> 
     6      <td>[?= $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td> 
     7    </tr> 
    88<?php endforeach; ?> 
    9 </tbody> 
     9  </tbody> 
    1010</table> 
     11 
    1112<hr /> 
    12 [?php echo link_to('edit', '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] 
    13 &nbsp;[?php echo link_to('list', '<?php echo $this->getModuleName() ?>/list') ?] 
     13 
     14<a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]">Edit</a> 
     15&nbsp; 
     16<a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/index') ?]">List</a> 
  • trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php

    r6174 r7131  
    1313  public function setup() 
    1414  { 
    15     $this->setWidgetSchema(new sfWidgetFormSchema(array( 
     15    $this->setWidgets(array( 
    1616<?php foreach ($this->table->getColumns() as $column): ?> 
    1717      '<?php echo strtolower($column->getColumnName()) ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getColumnName())) ?> => new <?php echo $this->getWidgetClassForColumn($column) ?>(<?php echo $this->getWidgetOptionsForColumn($column) ?>), 
    1818<?php endforeach; ?> 
    1919<?php foreach ($this->getManyToManyTables() as $tables): ?> 
    20       '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['relatedTable']->getPhpName() ?>Choices')))), 
     20      '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>Choices')))), 
    2121<?php endforeach; ?> 
    22     )))
     22    ))
    2323 
    24     $this->setValidatorSchema(new sfValidatorSchema(array( 
     24    $this->setValidators(array( 
    2525<?php foreach ($this->table->getColumns() as $column): ?> 
    2626      '<?php echo strtolower($column->getColumnName()) ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getColumnName())) ?> => new <?php echo $this->getValidatorClassForColumn($column) ?>(<?php echo $this->getValidatorOptionsForColumn($column) ?>), 
    2727<?php endforeach; ?> 
    2828<?php foreach ($this->getManyToManyTables() as $tables): ?> 
    29       '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['relatedTable']->getPhpName() ?>IdentifierChoices')))), 
     29      '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>IdentifierChoices')), 'required' => false)), 
    3030<?php endforeach; ?> 
    31     )))
     31    ))
    3232 
    3333    $this->widgetSchema->setNameFormat('<?php echo $this->table->getName() ?>[%s]'); 
     
    5555<?php endif; ?> 
    5656 
    57 <?php foreach ($this->getForeignKeyNames() as $name): ?> 
     57<?php foreach ($this->getForeignKeyNames() as $info): $name = $info[1] ?> 
    5858  public function get<?php echo $name ?>IdentifierChoices() 
    5959  { 
     
    6565    if (!isset($this-><?php echo $name ?>Choices)) 
    6666    { 
    67       $this-><?php echo $name ?>Choices = array(); 
    68       foreach (<?php echo $name ?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object) 
     67      $this-><?php echo $name ?>Choices = array(<?php !$info[2] && !$info[3] and print "'' => ''" ?>); 
     68      foreach (<?php echo $info[0] ?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object) 
    6969      { 
    7070        $this-><?php echo $name ?>Choices[$object->get<?php echo $this->getPrimaryKey()->getPhpName() ?>()] = $object->__toString(); 
  • trunk/lib/plugins/sfPropelPlugin/lib/creole/drivers/sfDebugConnection.php

    r6379 r7131  
    2222 * DebugConnection. 
    2323 * 
    24  * @author Michael Sims 
    25  * @package creole.drivers.debug 
     24 * @package    symfony 
     25 * @subpackage creole 
     26 * @author     Michael Sims 
    2627 */ 
    2728class sfDebugConnection implements Connection 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionObjectBuilder.php

    r2624 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionPeerBuilder.php

    r2624 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMapBuilderBuilder.php

    r3058 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMultiExtendObjectBuilder.php

    r1919 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php

    r6779 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php

    r6779 r7131  
    1313/** 
    1414 * @package    symfony 
    15  * @subpackage addon 
     15 * @subpackage propel 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/database/sfPropelDatabase.class.php

    r6370 r7131  
    3232    $config = array(); 
    3333 
    34   public function initialize($parameters = null, $name = 'propel'
     34  public function initialize($parameters = null
    3535  { 
    3636    parent::initialize($parameters); 
     
    3838    if (!$this->hasParameter('datasource')) 
    3939    { 
    40       $this->setParameter('datasource', $name); 
     40      $this->setParameter('datasource', $this->getParameter('name', 'propel')); 
    4141    } 
    4242 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php

    r6174 r7131  
    137137   * This method does not returns foreign keys that are also primary keys. 
    138138   * 
    139    * @return array An array of foreign key PHP names 
     139   * @return array An array composed of:  
     140   *                 * The foreign table PHP name 
     141   *                 * The foreign key PHP name 
     142   *                 * A Boolean to indicate whether the column is required or not 
     143   *                 * A Boolean to indicate whether the column is a many to many relationship or not 
    140144   */ 
    141145  public function getForeignKeyNames() 
     
    146150      if (!$column->isPrimaryKey() && $column->isForeignKey()) 
    147151      { 
    148         $names[] = $this->getForeignTable($column)->getPhpName(); 
     152        $names[] = array($this->getForeignTable($column)->getPhpName(), $column->getPhpName(), $column->isNotNull(), false); 
    149153      } 
    150154    } 
     
    152156    foreach ($this->getManyToManyTables() as $tables) 
    153157    { 
    154       $names[] = $tables['relatedTable']->getPhpName(); 
     158      $names[] = array($tables['relatedTable']->getPhpName(), $tables['middleTable']->getPhpName(), false, true); 
    155159    } 
    156160 
     
    241245    if (!$column->isPrimaryKey() && $column->isForeignKey()) 
    242246    { 
    243       $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $this->getForeignTable($column)->getPhpName()); 
     247      $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $column->getPhpName()); 
    244248    } 
    245249 
     
    327331    if (!$column->isPrimaryKey() && $column->isForeignKey()) 
    328332    { 
    329       $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sIdentifierChoices\'))', $this->dbMap->getTable($column->getRelatedTableName())->getPhpName()); 
     333      $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sIdentifierChoices\'))', $column->getPhpName()); 
    330334    } 
    331335 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfFormPropel.class.php

    r6175 r7131  
    1111/** 
    1212 * @package    symfony 
    13  * @subpackage propel 
     13 * @subpackage form 
    1414 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1515 * @version    SVN: $Id$ 
     
    2020 * 
    2121 * @package    symfony 
    22  * @subpackage propel 
     22 * @subpackage form 
    2323 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    2424 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php

    r5868 r7131  
    1111/** 
    1212 * @package    symfony 
    13  * @subpackage addon 
     13 * @subpackage propel 
    1414 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1515 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelBehavior.class.php

    r2453 r7131  
    1111/** 
    1212 * @package    symfony 
    13  * @subpackage addon 
     13 * @subpackage propel 
    1414 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1515 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php

    r6020 r7131  
    1010 
    1111/** 
    12  * This class is the Propel implementation of sfData.  It interacts with the data source 
    13  * and loads data. 
     12 * This class is the Propel implementation of sfData. 
     13 * 
     14 * It interacts with the data source and loads data. 
    1415 * 
    1516 * @package    symfony 
    16  * @subpackage addon 
     17 * @subpackage propel 
    1718 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1819 * @version    SVN: $Id$ 
     
    2122{ 
    2223  protected 
    23     $maps           = array(), 
    2424    $deletedClasses = array(), 
    2525    $con            = null; 
    2626 
    27   // symfony load-data (file|dir) 
    2827  /** 
    2928   * Loads data from a file or directory into a Propel data source 
     
    3736  { 
    3837    $fixture_files = $this->getFiles($directory_or_file); 
     38 
     39    // load map classes 
     40    $this->loadMapBuilders(); 
     41    $this->dbMap = Propel::getDatabaseMap($connectionName); 
    3942 
    4043    // wrap all database operations in a single transaction 
     
    8083      $peer_class = $class.'Peer'; 
    8184 
    82       // load map class 
    83       $this->loadMapBuilder($class); 
    84  
    85       $tableMap = $this->maps[$class]->getDatabaseMap()->getTable(constant($peer_class.'::TABLE_NAME')); 
     85      $tableMap = $this->dbMap->getTable(constant($peer_class.'::TABLE_NAME')); 
    8686 
    8787      $column_names = call_user_func_array(array($peer_class, 'getFieldNames'), array(BasePeer::TYPE_FIELDNAME)); 
     
    111111        foreach ($data as $name => $value) 
    112112        { 
     113          // will need to be updated for Propel 1.3 
     114          if (is_array($value) && 's' == substr($name, -1)) 
     115          { 
     116            // many to many relationship 
     117            $this->loadMany2Many($obj, substr($name, 0, -1), $value); 
     118 
     119            continue; 
     120          } 
     121 
    113122          $isARealColumn = true; 
    114123          try 
     
    126135            if ($column->isForeignKey() && !is_null($value)) 
    127136            { 
    128               $relatedTable = $this->maps[$class]->getDatabaseMap()->getTable($column->getRelatedTableName()); 
     137              $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 
    129138              if (!isset($this->object_references[$relatedTable->getPhpName().'_'.$value])) 
    130139              { 
    131140                throw new sfException(sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedTable->getPhpName())); 
    132141              } 
    133               $value = $this->object_references[$relatedTable->getPhpName().'_'.$value]
     142              $value = $this->object_references[$relatedTable->getPhpName().'_'.$value]->getPrimaryKey()
    134143            } 
    135144          } 
     
    150159        $obj->save($this->con); 
    151160 
    152         // save the id for future reference 
     161        // save the object for future reference 
    153162        if (method_exists($obj, 'getPrimaryKey')) 
    154163        { 
    155           $this->object_references[$class.'_'.$key] = $obj->getPrimaryKey(); 
    156         } 
    157       } 
     164          $this->object_references[$class.'_'.$key] = $obj; 
     165        } 
     166      } 
     167    } 
     168  } 
     169 
     170  /** 
     171   * Loads many to many objects. 
     172   * 
     173   * @param BaseObject A Propel object 
     174   * @param string     The middle table name 
     175   * @param array      An array of values 
     176   */ 
     177  protected function loadMany2Many($obj, $middleTableName, $values) 
     178  { 
     179    $middleTable = $this->dbMap->getTable($middleTableName); 
     180    $middleClass = $middleTable->getPhpName(); 
     181    foreach ($middleTable->getColumns()  as $column) 
     182    { 
     183      if ($column->isPrimaryKey() && $column->isForeignKey() && constant(get_class($obj).'Peer::TABLE_NAME') != $column->getRelatedTableName()) 
     184      { 
     185        $relatedClass = $this->dbMap->getTable($column->getRelatedTableName())->getPhpName(); 
     186        break; 
     187      } 
     188    } 
     189 
     190    if (!isset($relatedClass)) 
     191    { 
     192      throw new sfException(sprintf('Unable to find the many-to-many relationship for object "%s"', get_class($obj))); 
     193    } 
     194 
     195    $setter = 'set'.get_class($obj); 
     196    $relatedSetter = 'set'.$relatedClass; 
     197 
     198    foreach ($values as $value) 
     199    { 
     200      if (!isset($this->object_references[$relatedClass.'_'.$value])) 
     201      { 
     202        throw new sfException(sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedClass)); 
     203      } 
     204 
     205      $middle = new $middleClass(); 
     206      $middle->$setter($obj); 
     207      $middle->$relatedSetter($this->object_references[$relatedClass.'_'.$value]); 
     208      $middle->save(); 
    158209    } 
    159210  } 
     
    214265 
    215266  /** 
    216    * Loads the mappings for the classes 
    217    * 
    218    * @param string The model class name 
     267   * Loads all map builders. 
    219268   * 
    220269   * @throws sfException If the class cannot be found 
    221270   */ 
    222   protected function loadMapBuilder($class) 
    223   { 
    224     $mapBuilderClass = $class.'MapBuilder'; 
    225     if (!isset($this->maps[$class])) 
    226     { 
    227       if (!$classPath = sfAutoload::getInstance()->getClassPath($mapBuilderClass)) 
    228       { 
    229         throw new sfException(sprintf('Unable to find path for class "%s".', $mapBuilderClass)); 
    230       } 
    231  
    232       require_once($classPath); 
    233       $this->maps[$class] = new $mapBuilderClass(); 
    234       $this->maps[$class]->doBuild(); 
     271  protected function loadMapBuilders() 
     272  { 
     273    $files = sfFinder::type('file')->name('*MapBuilder.php')->in(sfLoader::getModelDirs()); 
     274    foreach ($files as $file) 
     275    { 
     276      $mapBuilderClass = basename($file, '.php'); 
     277      $map = new $mapBuilderClass(); 
     278      $map->doBuild(); 
    235279    } 
    236280  } 
     
    257301    } 
    258302 
     303    $this->loadMapBuilders(); 
    259304    $this->con = Propel::getConnection($connectionName); 
     305    $this->dbMap = Propel::getDatabaseMap($connectionName); 
    260306 
    261307    // get tables 
    262308    if ('all' === $tables || is_null($tables)) 
    263309    { 
    264       // load all map builder classes 
    265       $files = sfFinder::type('file')->name('*MapBuilder.php')->in(sfLoader::getModelDirs()); 
    266       foreach ($files as $file) 
    267       { 
    268         $mapBuilderClass = basename($file, '.php'); 
    269         $map = new $mapBuilderClass(); 
    270         $map->doBuild(); 
    271       } 
    272  
    273       $dbMap = Propel::getDatabaseMap($connectionName); 
    274310      $tables = array(); 
    275       foreach ($dbMap->getTables() as $table) 
     311      foreach ($this->dbMap->getTables() as $table) 
    276312      { 
    277313        $tables[] = $table->getPhpName(); 
     
    284320 
    285321    $dumpData = array(); 
    286  
    287     // load map classes 
    288     array_walk($tables, array($this, 'loadMapBuilder')); 
    289322 
    290323    $tables = $this->fixOrderingOfForeignKeyData($tables); 
    291324    foreach ($tables as $tableName) 
    292325    { 
    293       $tableMap = $this->maps[$tableName]->getDatabaseMap()->getTable(constant($tableName.'Peer::TABLE_NAME')); 
     326      $tableMap = $this->dbMap->getTable(constant($tableName.'Peer::TABLE_NAME')); 
    294327      $hasParent = false; 
    295328      $haveParents = false; 
     
    300333        if ($column->isForeignKey()) 
    301334        { 
    302           $relatedTable = $this->maps[$tableName]->getDatabaseMap()->getTable($column->getRelatedTableName()); 
     335          $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 
    303336          if ($tableName === $relatedTable->getPhpName()) 
    304337          { 
     
    365398            if ($column->isForeignKey()) 
    366399            { 
    367               $relatedTable = $this->maps[$tableName]->getDatabaseMap()->getTable($column->getRelatedTableName()); 
     400              $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 
    368401              if ($isPrimaryKey) 
    369402              { 
     
    424457    { 
    425458      $class = $classes[$i]; 
    426       $tableMap = $this->maps[$class]->getDatabaseMap()->getTable(constant($class.'Peer::TABLE_NAME')); 
     459      $tableMap = $this->dbMap->getTable(constant($class.'Peer::TABLE_NAME')); 
    427460      foreach ($tableMap->getColumns() as $column) 
    428461      { 
    429462        if ($column->isForeignKey()) 
    430463        { 
    431           $relatedTable = $this->maps[$class]->getDatabaseMap()->getTable($column->getRelatedTableName()); 
     464          $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 
    432465          $relatedTablePos = array_search($relatedTable->getPhpName(), $classes); 
    433466 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php

    r5820 r7131  
    1212 * 
    1313 * @package    symfony 
    14  * @subpackage addon 
     14 * @subpackage propel 
    1515 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1616 * @author     François Zaninotto <francois.zaninotto@symfony-project.com> 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelManyToMany.class.php

    r1931 r7131  
    1212 * 
    1313 * @package    symfony 
    14  * @subpackage uti
     14 * @subpackage prope
    1515 * @author     Nick Lane <nick.lane@internode.on.net> 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelPager.class.php

    r6467 r7131  
    1010 
    1111/** 
    12  * @package    symfony 
    13  * @subpackage addon 
    14  * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    15  * @version    SVN: $Id$ 
    16  */ 
    17  
    18 /** 
    1912 * 
    2013 * sfPropelPager class. 
    2114 * 
    2215 * @package    symfony 
    23  * @subpackage addon 
     16 * @subpackage propel 
    2417 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    2518 * @version    SVN: $Id$ 
  • trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php

    r6174 r7131  
    212212} 
    213213 
     214/** 
     215 * @package    symfony 
     216 * @subpackage command 
     217 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
     218 * @version    SVN: $Id$ 
     219 */ 
    214220class sfPhing extends Phing 
    215221{ 
  • trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php

    r6097 r7131  
    3232    $this->addOptions(array( 
    3333      new sfCommandOption('theme', null, sfCommandOption::PARAMETER_REQUIRED, 'The theme name', 'default'), 
     34      new sfCommandOption('generate-in-cache', null, sfCommandOption::PARAMETER_NONE, 'Generate the module in cache'), 
     35      new sfCommandOption('non-atomic-actions', null, sfCommandOption::PARAMETER_NONE, 'Generate non atomic actions'), 
     36      new sfCommandOption('non-verbose-templates', null, sfCommandOption::PARAMETER_NONE, 'Generate non verbose templates'), 
     37      new sfCommandOption('with-show', null, sfCommandOption::PARAMETER_NONE, 'Generate a show method'), 
     38      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), 
    3439    )); 
    3540 
     
    4651The task creates a [%module%|COMMENT] module in the [%application%|COMMENT] application 
    4752for the model class [%model%|COMMENT]. 
     53 
     54You can also create an empty module that inherits its actions and templates from 
     55a runtime generated module in [%sf_app_cache_dir%/modules/auto%module%|COMMENT] by 
     56using the [--generate-in-cache|COMMENT] option: 
     57 
     58  [./symfony propel:generate-crud --generate-in-cache frontend article Article|INFO] 
    4859 
    4960The generator can use a customized theme by using the [--theme|COMMENT] option: 
     
    6273    $properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true); 
    6374 
    64     // generate module 
    65     $tmpDir = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); 
    66     sfConfig::set('sf_module_cache_dir', $tmpDir); 
    67     $generatorManager = new sfGeneratorManager(); 
    68     $generatorManager->generate('sfPropelCrudGenerator', array('model_class' => $arguments['model'], 'moduleName' => $arguments['module'], 'theme' => $options['theme'])); 
    69  
    70     $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 
    71  
    72     // copy our generated module 
    73     $this->filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 
    74  
    75     // change module name 
    76     $this->filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 
    77  
    78     $constants = array( 
     75    $this->constants = array( 
    7976      'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 
    8077      'APP_NAME'     => $arguments['application'], 
     
    8481    ); 
    8582 
     83    $method = $options['generate-in-cache'] ? 'executeInit' : 'executeGenerate'; 
     84 
     85    $this->$method($arguments, $options); 
     86  } 
     87 
     88  protected function executeGenerate($arguments = array(), $options = array()) 
     89  { 
     90    $this->bootstrapSymfony($arguments['application'], $options['env'], true); 
     91 
     92    sfSimpleAutoload::getInstance()->unregister(); 
     93    sfSimpleAutoload::getInstance()->register(); 
     94 
     95    $databaseManager = new sfDatabaseManager(); 
     96 
     97    // generate module 
     98    $tmpDir = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); 
     99    sfConfig::set('sf_module_cache_dir', $tmpDir); 
     100    $generatorManager = new sfGeneratorManager(); 
     101    $generatorManager->generate('sfPropelCrudGenerator', array( 
     102      'model_class'           => $arguments['model'], 
     103      'moduleName'            => $arguments['module'], 
     104      'theme'                 => $options['theme'], 
     105      'non_atomic_actions'    => $options['non-atomic-actions'], 
     106      'non_verbose_templates' => $options['non-verbose-templates'], 
     107      'with_show'             => $options['with-show'], 
     108    )); 
     109 
     110    $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 
     111 
     112    // copy our generated module 
     113    $this->filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 
     114 
     115    if (!$options['with-show']) 
     116    { 
     117      $this->filesystem->remove($moduleDir.'/templates/showSuccess.php'); 
     118    } 
     119 
     120    // change module name 
     121    $this->filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 
     122 
    86123    // customize php and yml files 
    87124    $finder = sfFinder::type('file')->name('*.php', '*.yml'); 
    88     $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $constants); 
     125    $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
    89126 
    90127    // create basic test 
     
    92129 
    93130    // customize test file 
    94     $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $constants); 
     131    $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
    95132 
    96133    // delete temp files 
    97134    $this->filesystem->remove(sfFinder::type('any')->in($tmpDir)); 
    98135  } 
     136 
     137  protected function executeInit($arguments = array(), $options = array()) 
     138  { 
     139    $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 
     140 
     141    // create basic application structure 
     142    $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 
     143    $dirs = sfLoader::getGeneratorSkeletonDirs('sfPropelCrud', $options['theme']); 
     144    foreach ($dirs as $dir) 
     145    { 
     146      if (is_dir($dir)) 
     147      { 
     148        $this->filesystem->mirror($dir, $moduleDir, $finder); 
     149        break; 
     150      } 
     151    } 
     152 
     153    // create basic test 
     154    $this->filesystem->copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/module/test/actionsTest.php', sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 
     155 
     156    // customize test file 
     157    $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 
     158 
     159    // customize php and yml files 
     160    $finder = sfFinder::type('file')->name('*.php', '*.yml'); 
     161    $this->constants['CONFIG'] = sprintf("    non_atomic_actions:    %s\n    non_verbose_templates: %s\n    with_show:             %s", 
     162      $options['non-atomic-actions'] ? 'true' : 'false', 
     163      $options['non-verbose-templates'] ? 'true' : 'false', 
     164      $options['with-show'] ? 'true' : 'false' 
     165    ); 
     166    $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 
     167  } 
    99168} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/browseTest.php

    r6522 r7131  
    6666 
    6767  // first line 
    68   checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td', '1', array('position' => 0))-> 
    69   checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td', 'foo title', array('position' => 1))-> 
    70   checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td', 'bar body', array('position' => 2))-> 
    71   checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td img', true, array('position' => 3))-> 
    72   checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td', '1', array('position' => 4))-> 
     68  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(0)', '1')-> 
     69  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(1)', 'foo title')-> 
     70  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(2)', 'bar body')-> 
     71  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(3) img', true)-> 
     72  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(4)', '1')-> 
    7373  checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td a[href$="/article/edit/id/1"]', '1')-> // clickable 
    7474 
    7575  // second line 
    76   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td', '2', array('position' => 0))-> 
    77   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td', 'foo foo title', array('position' => 1))-> 
    78   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td', 'bar bar body', array('position' => 2))-> 
    79   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td img', false, array('position' => 3))-> 
    80   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td', '2', array('position' => 4))-> 
     76  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(0)', '2')-> 
     77  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(1)', 'foo foo title')-> 
     78  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(2)', 'bar bar body')-> 
     79  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(3) img', false)-> 
     80  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(4)', '2')-> 
    8181  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td a[href$="/article/edit/id/2"]', '2')-> 
    8282 
     
    158158  checkResponseElement('body form#sf_admin_edit_form input[name="article[online]"][id="article_online"][type="checkbox"][checked="checked"]', true)-> 
    159159  checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"]', true)-> 
    160   checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="1"]', '1')-> 
    161   checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="2"]', '2')-> 
     160  checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="1"]', 'Category 1')-> 
     161  checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="2"]', 'Category 2')-> 
    162162  checkResponseElement('body form#sf_admin_edit_form input[name="article[created_at]"][id="article_created_at"][value*="-"]')-> 
    163163 
     
    187187  checkResponseElement('#article_body', 'my body')-> 
    188188  checkResponseElement('input[id="article_online"][checked="checked"]', true)-> 
    189   checkResponseElement('#article_category_id option[selected="selected"]', '2') 
     189  checkResponseElement('#article_category_id option[selected="selected"]', 'Category 2') 
    190190; 
    191191 
     
    229229  checkResponseElement('input[id="article_title"][value="new title"]')-> 
    230230  checkResponseElement('#article_body', 'new body')-> 
    231   checkResponseElement('#article_category_id option[selected="selected"]', '2')-> 
     231  checkResponseElement('#article_category_id option[selected="selected"]', 'Category 2')-> 
    232232 
    233233  // check list 
    234234  getAndCheck('article', 'list')-> 
    235   checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td', '', array('position' => 7))-> 
     235  checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(7)', '')-> 
    236236 
    237237  // nb lines 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema.xml

    r5103 r7131  
    44  <table name="article"> 
    55    <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" /> 
    6     <column name="title" type="varchar" size="255" /> 
     6    <column name="title" type="varchar" size="255" required="true" /> 
    77    <column name="body" type="longvarchar" /> 
    88    <column name="online" type="boolean" /> 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Book.php

    r5103 r7131  
    1010class Book extends BaseBook 
    1111{ 
     12  public function __toString() 
     13  { 
     14    return $this->getName(); 
     15  } 
    1216} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Category.php

    r5103 r7131  
    1010class Category extends BaseCategory 
    1111{ 
     12  public function __toString() 
     13  { 
     14    return $this->getName(); 
     15  } 
    1216} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/map/ArticleMapBuilder.php

    r5103 r7131  
    3535    $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); 
    3636 
    37     $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, false, 255); 
     37    $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, true, 255); 
    3838 
    3939    $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false, null); 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticle.php

    r5103 r7131  
    676676  public function getCategory($con = null) 
    677677  { 
    678         include_once 'lib/model/om/BaseCategoryPeer.php'; 
    679  
    680678    if ($this->aCategory === null && ($this->category_id !== null)) { 
    681  
    682       $this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con); 
     679            $this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con); 
    683680 
    684681       
     
    706703  public function getBook($con = null) 
    707704  { 
    708         include_once 'lib/model/om/BaseBookPeer.php'; 
    709  
    710705    if ($this->aBook === null && ($this->book_id !== null)) { 
    711  
    712       $this->aBook = BookPeer::retrieveByPK($this->book_id, $con); 
     706            $this->aBook = BookPeer::retrieveByPK($this->book_id, $con); 
    713707 
    714708       
     
    728722  public function getAuthorArticles($criteria = null, $con = null) 
    729723  { 
    730         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    731     if ($criteria === null) { 
     724        if ($criteria === null) { 
    732725      $criteria = new Criteria(); 
    733726    } 
     
    766759  public function countAuthorArticles($criteria = null, $distinct = false, $con = null) 
    767760  { 
    768         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    769     if ($criteria === null) { 
     761        if ($criteria === null) { 
    770762      $criteria = new Criteria(); 
    771763    } 
     
    791783  public function getAuthorArticlesJoinAuthor($criteria = null, $con = null) 
    792784  { 
    793         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    794     if ($criteria === null) { 
     785        if ($criteria === null) { 
    795786      $criteria = new Criteria(); 
    796787    } 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticlePeer.php

    r5103 r7131  
    6767  public static function getMapBuilder() 
    6868  { 
    69     include_once 'lib/model/map/ArticleMapBuilder.php'; 
    7069    return BasePeer::getMapBuilder('lib.model.map.ArticleMapBuilder'); 
    7170  } 
     
    830829  } 
    831830} else { 
    832       require_once 'lib/model/map/ArticleMapBuilder.php'; 
    833   Propel::registerMapBuilder('lib.model.map.ArticleMapBuilder'); 
     831      Propel::registerMapBuilder('lib.model.map.ArticleMapBuilder'); 
    834832} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthor.php

    r5103 r7131  
    359359  public function getAuthorArticles($criteria = null, $con = null) 
    360360  { 
    361         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    362     if ($criteria === null) { 
     361        if ($criteria === null) { 
    363362      $criteria = new Criteria(); 
    364363    } 
     
    397396  public function countAuthorArticles($criteria = null, $distinct = false, $con = null) 
    398397  { 
    399         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    400     if ($criteria === null) { 
     398        if ($criteria === null) { 
    401399      $criteria = new Criteria(); 
    402400    } 
     
    422420  public function getAuthorArticlesJoinArticle($criteria = null, $con = null) 
    423421  { 
    424         include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 
    425     if ($criteria === null) { 
     422        if ($criteria === null) { 
    426423      $criteria = new Criteria(); 
    427424    } 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticle.php

    r5103 r7131  
    418418  public function getAuthor($con = null) 
    419419  { 
    420         include_once 'lib/model/om/BaseAuthorPeer.php'; 
    421  
    422420    if ($this->aAuthor === null && ($this->author_id !== null)) { 
    423  
    424       $this->aAuthor = AuthorPeer::retrieveByPK($this->author_id, $con); 
     421            $this->aAuthor = AuthorPeer::retrieveByPK($this->author_id, $con); 
    425422 
    426423       
     
    448445  public function getArticle($con = null) 
    449446  { 
    450         include_once 'lib/model/om/BaseArticlePeer.php'; 
    451  
    452447    if ($this->aArticle === null && ($this->article_id !== null)) { 
    453  
    454       $this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con); 
     448            $this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con); 
    455449 
    456450       
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticlePeer.php

    r5103 r7131  
    5252  public static function getMapBuilder() 
    5353  { 
    54     include_once 'lib/model/map/AuthorArticleMapBuilder.php'; 
    5554    return BasePeer::getMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 
    5655  } 
     
    805804  } 
    806805} else { 
    807       require_once 'lib/model/map/AuthorArticleMapBuilder.php'; 
    808   Propel::registerMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 
     806      Propel::registerMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 
    809807} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorPeer.php

    r5103 r7131  
    4949  public static function getMapBuilder() 
    5050  { 
    51     include_once 'lib/model/map/AuthorMapBuilder.php'; 
    5251    return BasePeer::getMapBuilder('lib.model.map.AuthorMapBuilder'); 
    5352  } 
     
    364363  } 
    365364} else { 
    366       require_once 'lib/model/map/AuthorMapBuilder.php'; 
    367   Propel::registerMapBuilder('lib.model.map.AuthorMapBuilder'); 
     365      Propel::registerMapBuilder('lib.model.map.AuthorMapBuilder'); 
    368366} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBook.php

    r5103 r7131  
    359359  public function getArticles($criteria = null, $con = null) 
    360360  { 
    361         include_once 'lib/model/om/BaseArticlePeer.php'; 
    362     if ($criteria === null) { 
     361        if ($criteria === null) { 
    363362      $criteria = new Criteria(); 
    364363    } 
     
    397396  public function countArticles($criteria = null, $distinct = false, $con = null) 
    398397  { 
    399         include_once 'lib/model/om/BaseArticlePeer.php'; 
    400     if ($criteria === null) { 
     398        if ($criteria === null) { 
    401399      $criteria = new Criteria(); 
    402400    } 
     
    422420  public function getArticlesJoinCategory($criteria = null, $con = null) 
    423421  { 
    424         include_once 'lib/model/om/BaseArticlePeer.php'; 
    425     if ($criteria === null) { 
     422        if ($criteria === null) { 
    426423      $criteria = new Criteria(); 
    427424    } 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBookPeer.php

    r5103 r7131  
    4949  public static function getMapBuilder() 
    5050  { 
    51     include_once 'lib/model/map/BookMapBuilder.php'; 
    5251    return BasePeer::getMapBuilder('lib.model.map.BookMapBuilder'); 
    5352  } 
     
    364363  } 
    365364} else { 
    366       require_once 'lib/model/map/BookMapBuilder.php'; 
    367   Propel::registerMapBuilder('lib.model.map.BookMapBuilder'); 
     365      Propel::registerMapBuilder('lib.model.map.BookMapBuilder'); 
    368366} 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategory.php

    r5103 r7131  
    359359  public function getArticles($criteria = null, $con = null) 
    360360  { 
    361         include_once 'lib/model/om/BaseArticlePeer.php'; 
    362     if ($criteria === null) { 
     361        if ($criteria === null) { 
    363362      $criteria = new Criteria(); 
    364363    } 
     
    397396  public function countArticles($criteria = null, $distinct = false, $con = null) 
    398397  { 
    399         include_once 'lib/model/om/BaseArticlePeer.php'; 
    400     if ($criteria === null) { 
     398        if ($criteria === null) { 
    401399      $criteria = new Criteria(); 
    402400    } 
     
    422420  public function getArticlesJoinBook($criteria = null, $con = null) 
    423421  { 
    424         include_once 'lib/model/om/BaseArticlePeer.php'; 
    425     if ($criteria === null) { 
     422        if ($criteria === null) { 
    426423      $criteria = new Criteria(); 
    427424    } 
  • trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategoryPeer.php

    r5103 r7131  
    4949  public static function getMapBuilder() 
    5050  { 
    51     include_once 'lib/model/map/CategoryMapBuilder.php'; 
    5251    return BasePeer::getMapBuilder('lib.model.map.CategoryMapBuilder'); 
    5352  } 
     
    364363  } 
    365364} else { 
    366       require_once 'lib/model/map/CategoryMapBuilder.php'; 
    367   Propel::registerMapBuilder('lib.model.map.CategoryMapBuilder'); 
     365      Propel::registerMapBuilder('lib.model.map.CategoryMapBuilder'); 
    368366} 
  • trunk/lib/request/sfWebRequest.class.php

    r6779 r7131  
    899899  } 
    900900 
     901  /** 
     902   * Parses the request parameters. 
     903   * 
     904   * This method notifies the request.filter_parameters event. 
     905   * 
     906   * @return array An array of request parameters. 
     907   */ 
    901908  protected function parseRequestParameters() 
    902909  { 
    903910    $parameters = array(); 
    904  
    905     try 
    906     { 
    907       $parameters = $this->dispatcher->filter(new sfEvent($this, 'request.filter_parameters', array('path_info' => $this->getPathInfo())), $parameters)->getReturnValue(); 
    908     } 
    909     catch (sfError404Exception $e) 
    910     { 
    911       $parameters['module'] = sfConfig::get('sf_error_404_module', 'default'); 
    912       $parameters['action'] = sfConfig::get('sf_error_404_action', 'error404'); 
    913     } 
     911    $parameters = $this->dispatcher->filter(new sfEvent($this, 'request.filter_parameters', array('path_info' => $this->getPathInfo())), $parameters)->getReturnValue(); 
    914912 
    915913    if (!isset($parameters['module'])) 
     
    923921    } 
    924922 
    925     $this->requestParameters = $parameters; 
     923    if (empty($parameters['module']) || empty($parameters['action'])) 
     924    { 
     925      throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $this->getPathInfo(), $parameters['module'], $parameters['action'])); 
     926    } 
     927 
     928    return $parameters; 
    926929  } 
    927930 
     
    937940 
    938941    // additional parameters 
    939     $this->parseRequestParameters(); 
     942    $this->requestParameters = $this->parseRequestParameters(); 
    940943    $this->parameterHolder->add($this->requestParameters); 
    941944 
  • trunk/lib/response/sfWebResponse.class.php

    r6779 r7131  
    246246  public function setContentType($value) 
    247247  { 
    248     // add charset if needed 
    249     if (false === stripos($value, 'charset') && 0 === stripos($value, 'text/')) 
     248    // add charset if needed (only on text content) 
     249    if (false === stripos($value, 'charset') && (0 === stripos($value, 'text/') || strlen($value) - 3 === strripos($value, 'xml'))) 
    250250    { 
    251251      $value .= '; charset='.$this->getParameter('charset'); 
  • trunk/lib/routing/sfNoRouting.class.php

    r6779 r7131  
    3838    unset($parameters['module'], $parameters['action']); 
    3939    ksort($parameters); 
    40     $parameters = count($parameters) ? '?'.http_build_query($parameters) : ''; 
     40    $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : ''; 
    4141 
    4242    return sprintf('%s/%s%s', $module, $action, $parameters); 
     
    5454  public function generate($name, $params, $querydiv = '/', $divider = '/', $equals = '/') 
    5555  { 
    56     $parameters = http_build_query(array_merge($this->defaultParameters, $params)); 
     56    $parameters = http_build_query(array_merge($this->defaultParameters, $params), null, '&'); 
    5757 
    5858    return '/'.($parameters ? '?'.$parameters : ''); 
  • trunk/lib/routing/sfPathInfoRouting.class.php

    r6779 r7131  
    3939    unset($parameters['module'], $parameters['action']); 
    4040    ksort($parameters); 
    41     $parameters = count($parameters) ? '?'.http_build_query($parameters) : ''; 
     41    $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : ''; 
    4242 
    4343    return sprintf('%s/%s%s', $module, $action, $parameters); 
  • trunk/lib/routing/sfPatternRouting.class.php

    r6779 r7131  
    601601      $this->currentRouteParameters = null; 
    602602 
    603       throw new sfError404Exception('No matching route found'); 
     603      throw new sfError404Exception(sprintf('No matching route found for "%s"', $url)); 
    604604    } 
    605605 
  • trunk/lib/task/cache/sfCacheClearTask.class.php

    r5260 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/generator/sfGenerateAppTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/generator/sfGenerateControllerTask.class.php

    r6097 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/generator/sfGenerateModuleTask.class.php

    r6097 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/generator/sfGenerateProjectTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/generator/sfGeneratorBaseTask.class.php

    r4743 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/help/sfCommandApplicationTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/help/sfHelpTask.class.php

    r5250 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/help/sfListTask.class.php

    r5250 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/i18n/sfI18nExtractTask.class.php

    r5232 r7131  
    1919 * 
    2020 * @package    symfony 
    21  * @subpackage command 
     21 * @subpackage task 
    2222 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    2323 * @version    SVN: $Id$ 
  • trunk/lib/task/i18n/sfI18nFindTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/log/sfLogClearTask.class.php

    r4841 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/log/sfLogRotateTask.class.php

    r4886 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginAddChannelTask.class.php

    r5457 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginBaseTask.class.php

    r5260 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginInstallTask.class.php

    r5361 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginListTask.class.php

    r5361 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginUninstallTask.class.php

    r5361 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/plugin/sfPluginUpgradeTask.class.php

    r5361 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectClearControllersTask.class.php

    r4743 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectDeployTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectDisableTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectEnableTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectFreezeTask.class.php

    r6779 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectPermissionsTask.class.php

    r5083 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfProjectUnfreezeTask.class.php

    r6779 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/sfUpgradeTo11Task.class.php

    r5269 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php

    r6507 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfComponentUpgrade.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php

    r5260 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php

    r6373 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfFlashUpgrade.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfLoggerUpgrade.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfPropelUpgrade.class.php

    r6336 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfSingletonUpgrade.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfUpgrade.class.php

    r5269 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/project/upgrade1.1/sfWebDebugUpgrade.class.php

    r6509 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/sfBaseTask.class.php

    r5236 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
     
    6767  public function bootstrapSymfony($app, $env = 'dev', $debug = true) 
    6868  { 
     69    if (defined('SF_ROOT_DIR')) 
     70    { 
     71      return; 
     72    } 
     73 
    6974    define('SF_ROOT_DIR',    sfConfig::get('sf_root_dir')); 
    7075    define('SF_APP',         $app); 
  • trunk/lib/task/sfTask.class.php

    r5232 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
     
    8686    $commandManager = new sfCommandManager(new sfCommandArgumentSet($this->getArguments()), new sfCommandOptionSet($this->getOptions())); 
    8787 
    88     return $this->doRun($commandManager, array_merge($arguments, $options)); 
     88    // add -- before each option if needed 
     89    foreach ($options as &$option) 
     90    { 
     91      if (0 !== strpos($option, '--')) 
     92      { 
     93        $option = '--'.$option; 
     94      } 
     95    } 
     96 
     97    return $this->doRun($commandManager, implode(' ', array_merge($arguments, $options))); 
    8998  } 
    9099 
  • trunk/lib/task/test/sfTestAllTask.class.php

    r4743 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/test/sfTestFunctionalTask.class.php

    r4743 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/task/test/sfTestUnitTask.class.php

    r4743 r7131  
    1313 * 
    1414 * @package    symfony 
    15  * @subpackage command 
     15 * @subpackage task 
    1616 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1717 * @version    SVN: $Id$ 
  • trunk/lib/user/sfUser.class.php

    r6779 r7131  
    8888    // otherwise 
    8989    //  - use the culture defined in the user session 
    90     //  - use the default culture set in i18n.yml 
     90    //  - use the default culture set in settings.yml 
    9191    $currentCulture = $storage->read(self::CULTURE_NAMESPACE); 
    9292    $this->setCulture($this->getParameter('culture', !is_null($currentCulture) ? $currentCulture : $this->getParameter('default_culture', 'en'))); 
  • trunk/lib/util/sfAutoload.class.php

    r5384 r7131  
    1616 * 
    1717 * @package    symfony 
     18 * @subpackage util 
    1819 * @author     Fabien Potencier <fabien.potencier@symfony-project.com> 
    1920 * @version    SVN: $Id$ 
     
    2829    $classes = array(); 
    2930 
    30   protected function __construct() 
    31   { 
    32   } 
    33  
     31  /** 
     32   * Retrieves the singleton instance of this class. 
     33   * 
     34   * @return sfAutoload A sfAutoload implementation instance. 
     35   */ 
    3436  static public function getInstance() 
    3537  { 
     
    4244  } 
    4345 
     46  /** 
     47   * Register sfAutoload in spl autoloader. 
     48   * 
     49   * @return void 
     50   */ 
    4451  public function register() 
    4552  { 
     
    4956  } 
    5057 
     58  /** 
     59   * Unregister sfAutoload from spl autoloader. 
     60   * 
     61   * @return void 
     62   */ 
    5163  public function unregister() 
    5264  { 
     
    5466  } 
    5567 
     68  /** 
     69   * Sets path to class. 
     70   * 
     71   * @param  string  A class name. 
     72   * @param  string  Path to class. 
     73   * 
     74   * @return void 
     75   */ 
    5676  public function setClassPath($class, $path) 
    5777  { 
     
    6181  } 
    6282 
     83  /** 
     84   * Get path to class. 
     85   * 
     86   * @param  string  A class name. 
     87   * 
     88   * @return void 
     89   */ 
    6390  public function getClassPath($class) 
    6491  { 
     
    6693  } 
    6794 
     95  /** 
     96   * Reloads all registered classes. 
     97   * 
     98   * @param  boolean Force delete of autoload cache? 
     99   * 
     100   * @return void 
     101   */ 
    68102  public function reloadClasses($force = false) 
    69103  { 
     
    106140  } 
    107141 
    108   function autoloadAgain($class) 
     142  /** 
     143   * Reloads a class. 
     144   * 
     145   * @param  string  A class name. 
     146   * 
     147   * @return boolean Returns true if the class has been loaded 
     148   */ 
     149  public function autoloadAgain($class) 
    109150  { 
    110151    self::reloadClasses(true); 
  • trunk/lib/util/sfBrowser.class.php

    r6779 r7131  
    3333    $currentException   = null; 
    3434 
     35  /** 
     36   * Class constructor. 
     37   * 
     38   * @param string Hostname to browse 
     39   * @param string Remote address to spook 
     40   * @param array  Options for sfBrowser 
     41   * 
     42   * @return void 
     43   */ 
    3544  public function __construct($hostname = null, $remote = null, $options = array()) 
    3645  { 
     
    3847  } 
    3948 
     49  /** 
     50   * Initializes sfBrowser - sets up environment 
     51   * 
     52   * @param string Hostname to browse 
     53   * @param string Remote address to spook 
     54   * @param array  Options for sfBrowser 
     55   * 
     56   * @return void 
     57   */ 
    4058  public function initialize($hostname = null, $remote = null, $options = array()) 
    4159  { 
     
    6078  } 
    6179 
     80  /** 
     81   * Sets variable name 
     82   * 
     83   * @param string The variable name 
     84   * @param mixed  The value 
     85   * 
     86   * @return sfBrowser 
     87   */ 
    6288  public function setVar($name, $value) 
    6389  { 
     
    6793  } 
    6894 
    69   public function setAuth($login, $password) 
    70   { 
    71     $this->vars['PHP_AUTH_USER'] = $login; 
     95  /** 
     96   * Sets username and password for simulating http authentication. 
     97   * 
     98   * @param string The username 
     99   * @param string The password 
     100   * 
     101   * @return sfBrowser 
     102   */ 
     103  public function setAuth($username, $password) 
     104  { 
     105    $this->vars['PHP_AUTH_USER'] = $username; 
    72106    $this->vars['PHP_AUTH_PW']   = $password; 
    73107 
     
    75109  } 
    76110 
     111  /** 
     112   * Gets a uri. 
     113   * 
     114   * @param string The URI to fetch 
     115   * @param array  The Request parameters 
     116   * 
     117   * @return sfBrowser 
     118   */ 
    77119  public function get($uri, $parameters = array()) 
    78120  { 
     
    80122  } 
    81123 
     124  /** 
     125   * Posts a uri. 
     126   * 
     127   * @param string The URI to fetch 
     128   * @param array  The Request parameters 
     129   * 
     130   * @return sfBrowser 
     131   */ 
    82132  public function post($uri, $parameters = array()) 
    83133  { 
     
    85135  } 
    86136 
     137  /** 
     138   * Calls a request to a uri. 
     139   * 
     140   * @param string The URI to fetch 
     141   * @param string The request method 
     142   * @param array  The Request parameters 
     143   * @param boolean Change the browser history stack? 
     144   * 
     145   * @return sfBrowser 
     146   */ 
    87147  public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) 
    88148  { 
     
    228288  } 
    229289 
     290  /** 
     291   * Go back in the browser history stack. 
     292   * 
     293   * @return sfBrowser 
     294   */ 
    230295  public function back() 
    231296  { 
     
    239304  } 
    240305 
     306  /**