Development

#3232: sfValidatorConfigHandler.class.patch

You must first sign up to be able to contribute.

Ticket #3232: sfValidatorConfigHandler.class.patch

File sfValidatorConfigHandler.class.patch, 1.5 kB (added by FabianLange, 8 months ago)

enables the fillin feature of validation yml files to work without any validators

  • sfValidatorConfigHandler.class.php

    old new  
    4545    { 
    4646      if (!isset($config[$category])) 
    4747      { 
    48         throw new sfParseException(sprintf('Configuration file "%s" is missing "%s" category', $configFiles[0], $category)); 
     48        if (!isset($config['fillin'])) 
     49        { 
     50          throw new sfParseException(sprintf('Configuration file "%s" is missing "%s" category', $configFiles[0], $category)); 
     51        } 
     52        $config[$category] = array(); 
    4953      } 
    5054    } 
    5155 
     
    97101    $data[] = "if (\$_SERVER['REQUEST_METHOD'] == 'GET')"; 
    98102    $data[] = "{"; 
    99103 
    100     $ret = $this->generateRegistration('GET', $data, $methods, $names, $validators); 
     104    $this->generateRegistration('GET', $data, $methods, $names, $validators); 
    101105 
    102     if ($ret
     106    if (count($fillin)
    103107    { 
    104108      $data[] = sprintf("  \$context->getRequest()->setAttribute('fillin', %s, 'symfony/filter');", $fillin); 
    105109    } 
     
    110114    $data[] = "else if (\$_SERVER['REQUEST_METHOD'] == 'POST')"; 
    111115    $data[] = "{"; 
    112116 
    113     $ret = $this->generateRegistration('POST', $data, $methods, $names, $validators); 
     117    $this->generateRegistration('POST', $data, $methods, $names, $validators); 
    114118 
    115     if ($ret
     119    if (count($fillin)
    116120    { 
    117121      $data[] = sprintf("  \$context->getRequest()->setAttribute('fillin', %s, 'symfony/filter');", $fillin); 
    118122    }