Development

Changeset 8919

You must first sign up to be able to contribute.

Changeset 8919

Show
Ignore:
Timestamp:
05/13/08 04:21:43 (2 months ago)
Author:
Jonathan.Wage
Message:

fixes #3499

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrinePlugin/trunk/lib/generator/sfDoctrineFormGenerator.class.php

    r8744 r8919  
    247247   * @return string    The name of a subclass of sfWidgetForm 
    248248   */ 
    249   public function getWidgetClassForColumn($name) 
    250   { 
    251     $column = $this->table->getDefinitionOf($name); 
     249  public function getWidgetClassForColumn($columnName) 
     250  { 
     251    $column = $this->table->getDefinitionOf($columnName); 
    252252    switch ($column['type']) 
    253253    { 
    254254      case 'boolean': 
    255         $name = 'InputCheckbox'; 
     255        $widgetSubclass = 'InputCheckbox'; 
    256256        break; 
    257257      case 'glob': 
    258258      case 'clob': 
    259         $name = 'Textarea'; 
     259        $widgetSubclass = 'Textarea'; 
    260260        break; 
    261261      case 'date': 
    262         $name = 'Date'; 
     262        $widgetSubclass = 'Date'; 
    263263        break; 
    264264      case 'time': 
    265         $name = 'Time'; 
     265        $widgetSubclass = 'Time'; 
    266266        break; 
    267267      case 'timestamp': 
    268         $name = 'DateTime'; 
     268        $widgetSubclass = 'DateTime'; 
    269269        break; 
    270270      default: 
    271         $name = 'Input'; 
    272     } 
    273  
    274  
    275     if ($this->isColumnPrimaryKey($name)) 
    276     { 
    277       $name = 'InputHidden'; 
    278     } 
    279     else if ($this->isColumnForeignKey($name)) 
    280     { 
    281       $name = 'DoctrineSelect'; 
    282     } 
    283  
    284     return sprintf('sfWidgetForm%s', $name); 
     271        $widgetSubclass = 'Input'; 
     272    } 
     273 
     274 
     275    if ($this->isColumnPrimaryKey($columnName)) 
     276    { 
     277      $widgetSubclass = 'InputHidden'; 
     278    } 
     279    else if ($this->isColumnForeignKey($columnName)) 
     280    { 
     281      $widgetSubclass = 'DoctrineSelect'; 
     282    } 
     283 
     284    return sprintf('sfWidgetForm%s', $widgetSubclass); 
    285285  } 
    286286 
     
    373373   * @return string    The name of a subclass of sfValidator 
    374374   */ 
    375   public function getValidatorClassForColumn($colName) 
    376   { 
    377     $column = $this->table->getDefinitionOf($colName); 
     375  public function getValidatorClassForColumn($columnName) 
     376  { 
     377    $column = $this->table->getDefinitionOf($columnName); 
    378378    switch ($column['type']) 
    379379    { 
    380380      case 'boolean': 
    381         $name = 'Boolean'; 
     381        $validatorSubclass = 'Boolean'; 
    382382        break; 
    383383      case 'string': 
    384384      case 'clob': 
    385385      case 'glob': 
    386         $name = 'String'; 
     386        $validatorSubclass = 'String'; 
    387387        break; 
    388388      case 'float': 
    389389      case 'decimal': 
    390390      case 'integer': 
    391         $name = 'Number'; 
     391        $validatorSubclass = 'Number'; 
    392392        break; 
    393393      case 'integer': 
    394         $name = 'Integer'; 
     394        $validatorSubclass = 'Integer'; 
    395395        break; 
    396396      case 'date': 
    397         $name = 'Date'; 
     397        $validatorSubclass = 'Date'; 
    398398        break; 
    399399      case 'time': 
    400         $name = 'Time'; 
     400        $validatorSubclass = 'Time'; 
    401401        break; 
    402402      case 'timestamp': 
    403         $name = 'DateTime'; 
     403        $validatorSubclass = 'DateTime'; 
    404404        break; 
    405405      default: 
    406         $name = 'Pass'; 
    407     } 
    408  
    409     if ($this->isColumnPrimaryKey($colName) || $this->isColumnForeignKey($colName)) 
    410     { 
    411       $name = 'DoctrineChoice'; 
    412     } 
    413  
    414     return sprintf('sfValidator%s', $name); 
     406        $validatorSubclass = 'Pass'; 
     407    } 
     408 
     409    if ($this->isColumnPrimaryKey($columnName) || $this->isColumnForeignKey($columnName)) 
     410    { 
     411      $validatorSubclass = 'DoctrineChoice'; 
     412    } 
     413 
     414    return sprintf('sfValidator%s', $validatorSubclass); 
    415415  } 
    416416