All,
I think the larger problem breaks down into three pieces:
Input Filter Framework
Input/Form Validation Framework
Output Escaping Framework
Each piece should follow the symfony platform standards: OOP,
separation/independent, flexible/extendable, easy to implement, and fast.
+1 for creating a complete OOP interface to ext/filter similar to Zend.
I think the mvc framework should provide an easy interface to combine these
sub-frameworks ensuring its easy to use and follow DRY/KISS. I do not think
yaml is the answer, but we should ultimately try to build a simple/reusable
api. If someone wants to write an adapter that makes it simple with yaml,
than why not.
The end goal is to make people define the type of data they want, how it
should be validated, and make sure that when displayed to user it is
escaped.
I think we should expose the filter methods via the getRequestParameter to
make it easy for simple cases, yet use sfInputFilter instances for complex
ones. Also, once something is filtered, it should be cached, maybe a
sfNamespacedParameterHolder is appropriate?
- Dustin
>
> hi,
>
> as you may know, i'm responsible for implementing input filtering in
> the forthcoming symfony-1.2.
>
> before starting to code anything, i would like to get some community
> feedback about the different solutions i've came up with :
>
> (in any case, the underlying filtering framework will be ext/filter[1])
>
> * first solution : extend the sfRequest::getParameter() semantics,
> adding a simple ext/filter wrapper. eg. :
>
> // Signature
> public function getParameter($name, $default_value, $filter_name,
> array $filter_options)
>
> // Usage
> $request->getParameter('foo', 'bar', FILTER_VALIDATE_INT,
> array('min_range' => 5, 'max_range' => 10, 'flags' =>
> FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX));
>
> * second solution : extend the sfRequest::getParameter() semantics,
> abstracting the filtering logic. eg. :
>
> // Signature
> public function getParameter($name, $default_value, sfInputFilter
> $filter_instance)
>
> // Usage
> $request->getParameter('foo', 'bar', new
> sfExtFilterInputFilter(array('id' => FILTER_VALIDATE_INT, 'options' =>
> array('min_range' => 5, 'max_range' => 10, 'flags' =>
> FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX)));
>
> * third solution : implement a complete input filtering framework
> similar to what can be found in the zend framework[2]
> * fourth solution : something better that i've not thought about :)
>
> looking forward to your insights.
>
> ++
> tristan
>
> [1] http://php.net/filter
> [2] http://framework.zend.com/manual/en/zend.filter.input.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---