On Mon, Apr 15, 2013 at 8:44 AM, Griesi <ebert.ch...@gmail.com> wrote: > OK. But wouldn't it make sense hat the filter is automatically applied if > the form has been validated as a whole? Currently you need to call get > data. If you do not need to call getData because the form does not have > any other input fields than file and you already provide the target file > name for the filter it is a hard to track why the filter does not work
The workflow for forms is: - setData() - isValid() - getData() (or, if using object binding, just access the object you bound) - OR getMessages() (if the form was invalid) That's the workflow. File uploads are odd because they have side effects. I think it's better to have an explicit point at which the side effects occur, and doing it as part of getData(), when the values are mapped, makes the most sense. > Am 15.04.2013 15:22 schrieb "weierophinney [via Zend Framework Community]" < > ml-node+s634137n4659719...@n4.nabble.com>: > >> On Thu, Apr 11, 2013 at 12:32 PM, Griesi <[hidden >> email]<http://user/SendEmail.jtp?type=node&node=4659719&i=0>> >> wrote: >> > I just found out that I am wrong. Filters are in general applied before >> > validation. Except with the FileInput Filter. This filter is only >> applied if >> > §form->getData() is called. Is this a bug or an intended behaviour? >> Wouldn´t >> > it make sense to at least apply the filter automatically if the form >> > isValid? >> >> Intended behavior. The reason is that we need to make sure that the >> $_FILES entry is valid before we do anything irrevocable, such as >> moving the file into a storage directory, renaming it, etc. As such, >> file filters need to be invoked after validation. >> >> -- >> Matthew Weier O'Phinney >> Project Lead | [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4659719&i=1> >> Zend Framework | http://framework.zend.com/ >> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc >> >> -- >> List: [hidden email]<http://user/SendEmail.jtp?type=node&node=4659719&i=2> >> Info: http://framework.zend.com/archives >> Unsubscribe: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=4659719&i=3> >> >> >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://zend-framework-community.634137.n4.nabble.com/ZF2-Form-Apply-filters-before-validation-tp4659701p4659719.html >> To unsubscribe from ZF2 - Form - Apply filters before validation, click >> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4659701&code=ZWJlcnQuY2hyaXNAZ21haWwuY29tfDQ2NTk3MDF8LTE5OTY1MTQ1MDQ=> >> . >> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/ZF2-Form-Apply-filters-before-validation-tp4659701p4659721.html > Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com