Development

Changeset 3269

You must first sign up to be able to contribute.

Changeset 3269

Show
Ignore:
Timestamp:
01/13/07 22:16:13 (2 years ago)
Author:
chtito
Message:

some refactoring in the admin generator classes; fixes #1334

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/addon/propel/generator/sfPropelCrudGenerator.class.php

    r2995 r3269  
    7272 
    7373  // generates a PHP call to an object helper 
    74   function getPHPObjectHelper($helperName, $column, $params
     74  function getPHPObjectHelper($helperName, $column, $params, $localParams = array()
    7575  { 
     76    $params = $this->getObjectTagParams($params, $localParams); 
    7677    return sprintf ('object_%s($%s, \'%s\', %s)', $helperName, $this->getSingularName(), $this->getColumnGetter($column, false), $params); 
    7778  } 
  • trunk/lib/generator/sfAdminGenerator.class.php

    r3162 r3269  
    227227      else 
    228228      { 
    229         $params = $this->getObjectTagParams($params); 
    230          
    231229        return $this->getPHPObjectHelper($inputType, $column, $params); 
    232230      } 
  • trunk/lib/generator/sfCrudGenerator.class.php

    r3215 r3269  
    256256    if ($column->isForeignKey()) 
    257257    { 
    258       $params = $this->getObjectTagParams($params, array('related_class' => $this->getRelatedClassName($column))); 
    259       return $this->getPHPObjectHelper('select_tag', $column, $params); 
     258      return $this->getPHPObjectHelper('select_tag', $column, $params, array('related_class' => $this->getRelatedClassName($column))); 
    260259    } 
    261260    else if ($type == CreoleTypes::DATE) 
    262261    { 
    263262      // rich=false not yet implemented 
    264       $params = $this->getObjectTagParams($params, array('rich' => true)); 
    265       return $this->getPHPObjectHelper('input_date_tag', $column, $params); 
     263      return $this->getPHPObjectHelper('input_date_tag', $column, $params, array('rich' => true)); 
    266264    } 
    267265    else if ($type == CreoleTypes::TIMESTAMP) 
    268266    { 
    269267      // rich=false not yet implemented 
    270       $params = $this->getObjectTagParams($params, array('rich' => true, 'withtime' => true)); 
    271       return $this->getPHPObjectHelper('input_date_tag', $column, $params); 
     268      return $this->getPHPObjectHelper('input_date_tag', $column, $params, array('rich' => true, 'withtime' => true)); 
    272269    } 
    273270    else if ($type == CreoleTypes::BOOLEAN) 
    274271    { 
    275       $params = $this->getObjectTagParams($params); 
    276272      return $this->getPHPObjectHelper('checkbox_tag', $column, $params); 
    277273    } 
     
    279275    { 
    280276      $size = ($column->getSize() > 20 ? ($column->getSize() < 80 ? $column->getSize() : 80) : 20); 
    281       $params = $this->getObjectTagParams($params, array('size' => $size)); 
    282       return $this->getPHPObjectHelper('input_tag', $column, $params); 
     277      return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => $size)); 
    283278    } 
    284279    else if ($type == CreoleTypes::INTEGER || $type == CreoleTypes::TINYINT || $type == CreoleTypes::SMALLINT || $type == CreoleTypes::BIGINT) 
    285280    { 
    286       $params = $this->getObjectTagParams($params, array('size' => 7)); 
    287       return $this->getPHPObjectHelper('input_tag', $column, $params); 
     281      return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => 7)); 
    288282    } 
    289283    else if ($type == CreoleTypes::FLOAT || $type == CreoleTypes::DOUBLE || $type == CreoleTypes::DECIMAL || $type == CreoleTypes::NUMERIC || $type == CreoleTypes::REAL) 
    290284    { 
    291       $params = $this->getObjectTagParams($params, array('size' => 7)); 
    292       return $this->getPHPObjectHelper('input_tag', $column, $params); 
     285      return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => 7)); 
    293286    } 
    294287    else if ($type == CreoleTypes::TEXT || $type == CreoleTypes::LONGVARCHAR) 
    295288    { 
    296       $params = $this->getObjectTagParams($params, array('size' => '30x3')); 
    297       return $this->getPHPObjectHelper('textarea_tag', $column, $params); 
     289      return $this->getPHPObjectHelper('textarea_tag', $column, $params, array('size' => '30x3')); 
    298290    } 
    299291    else 
    300292    { 
    301       $params = $this->getObjectTagParams($params, array('disabled' => true)); 
    302       return $this->getPHPObjectHelper('input_tag', $column, $params); 
     293      return $this->getPHPObjectHelper('input_tag', $column, $params, array('disabled' => true)); 
    303294    } 
    304295  } 
     
    310301 
    311302  // generates a PHP call to an object helper 
    312   abstract function getPHPObjectHelper($helperName, $column, $params); 
     303  abstract function getPHPObjectHelper($helperName, $column, $params, $localParams = array()); 
    313304 
    314305  // returns the getter either non-developped: 'getFoo'