merged branch jankramer/master (PR #3478)

Commits
-------

e6577de Added a 'post validation' event to the form component.

Discussion
----------

[Form] Add post-validate event

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: n/a
Fixes the following tickets: n/a
Todo: n/a

---------------------------------------------------------------------------

by fabpot at 2012-03-02T20:34:18Z

ping @bschussek

---------------------------------------------------------------------------

by vicb at 2012-03-04T09:19:53Z

I think this is a good idea (It was something missing to properly handle PersistentFile i.e. you should not persist invalid files)

---------------------------------------------------------------------------

by vicb at 2012-03-09T22:35:26Z

@jankramer please remove the second commit from this PR (see http://symfony.com/doc/current/contributing/code/patches.html) in order to make this mergeable.

---------------------------------------------------------------------------

by jankramer at 2012-03-10T09:26:04Z

@vicb done, sorry about that commit: overlooked the fact that it was on the same branch...
This commit is contained in:
Fabien Potencier 2012-03-15 16:46:57 +01:00
commit 0aac3613e1
2 changed files with 5 additions and 0 deletions

View File

@ -566,6 +566,9 @@ class Form implements \IteratorAggregate, FormInterface
foreach ($this->validators as $validator) {
$validator->validate($this);
}
$event = new DataEvent($this, $clientData);
$this->dispatcher->dispatch(FormEvents::POST_VALIDATE, $event);
return $this;
}

View File

@ -29,4 +29,6 @@ final class FormEvents
const BIND_NORM_DATA = 'form.bind_norm_data';
const SET_DATA = 'form.set_data';
const POST_VALIDATE = 'form.post_validate';
}