phpzend-frameworkzend-filter

Zend_Filter_Input - get filtered values to Array


I try to extract all filtered fields from Zend_Filter_Input in order to add extra fields and pass it to the model to insert or update, however I getting lost with extract piece:

$filters = Array(   '*'         => Array( 'StripTags', 'StringTrim' ) );

$data =  new Zend_Filter_Input( $filters, Array( ), $this->_request->getParams( ) );
// line below does't work what I should use instead ?
$data = $data->toArray( );

foreach ( $extra_fields as $key => $value ) {
    $data [ $key ] = $value;
} // FOREACH

I just looking to get all filtered fields as array of value pairs.


Solution

  • $data = $data->getEscaped();
    

    Go and have a look here : http://zendframework.com/manual/en/zend.filter.input.html for more informations