Development

Changeset 8284

You must first sign up to be able to contribute.

Changeset 8284

Show
Ignore:
Timestamp:
04/04/08 14:57:26 (5 months ago)
Author:
nicolas
Message:

fixes #2834 - fixed wrong formatters references returned when calling sfWidgetFormSchema ->getFormFormatter*()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/widget/sfWidgetFormSchema.class.php

    r8021 r8284  
    132132    $name = $this->getFormFormatterName(); 
    133133 
    134     if (isset($this->formFormatters[$name])) 
    135     { 
    136       return $this->formFormatters[$name]; 
    137     } 
    138  
    139     $class = 'sfWidgetFormSchemaFormatter'.ucfirst($name); 
    140     if (class_exists($class)) 
    141     { 
    142       return new $class(); 
    143     } 
    144  
    145     throw new InvalidArgumentException(sprintf('The form formatter "%s" does not exist.', $name)); 
     134    if (!isset($this->formFormatters[$name])) 
     135    { 
     136      $class = 'sfWidgetFormSchemaFormatter'.ucfirst($name); 
     137       
     138      if (!class_exists($class)) 
     139      { 
     140        throw new InvalidArgumentException(sprintf('The form formatter "%s" does not exist.', $name)); 
     141      } 
     142       
     143      $this->formFormatters[$name] = new $class(); 
     144    } 
     145     
     146    return $this->formFormatters[$name]; 
    146147  } 
    147148 
     
    302303   * 
    303304   * @param  string The name of the HTML widget 
    304    * @param  mixed  The value of the widget 
     305   * @param  mixed  The values of the widget 
    305306   * @param  array  An array of HTML attributes 
    306307   * @param  array  An array of errors 
  • branches/1.1/test/unit/widget/sfWidgetFormSchemaTest.php

    r8021 r8284  
    9393} 
    9494 
    95 $t->is($w->getFormFormatters(), array('custom' => $customFormatter), '->getFormFormatters() returns an array of all formatter for this widget schema'); 
     95$formatterNames = array_keys($w->getFormFormatters()); 
     96sort($formatterNames); 
     97$t->is($formatterNames, array('custom', 'list', 'table'), '->getFormFormatters() returns an array of all formatter for this widget schema'); 
    9698 
    9799// ->setNameFormat() ->getNameFormat() ->generateName()