ZF-7293: Zend_Filter_Input mapping key names

Description

It would be cool to mapping the field names to another name. Something like this:

 
$filters = array(
  'oldname' => array(
     'mapping_to' => 'newname'
  )
);

Note that you have to name your validators with the 'mapping_to' name. Here my extended version:

 
My_Filter_Input extends Zend_Filter_Input
{

   const MAPPING_TO = 'mapping_to';

   protected function _filterRule(array $filterRule)
  {
     parent::_filterRule($filterRule);

     $field = $filterRule[self::FIELDS];

     if (!array_key_exists($field, $this->_data)) {
         return;
     }

     if (isset($filterRule[self::MAPPING_TO])) {
         $this->_data[$filterRule[self::MAPPING_TO]] = $this->_data[$field];
         unset($this->_data[$field]);
     }
  }

}

Comments

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.