2011-05-30 08:19:21 +01:00
|
|
|
<?php
|
2015-03-24 16:36:00 +00:00
|
|
|
|
2011-05-30 08:19:21 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Symfony\Component\Form;
|
|
|
|
|
|
|
|
/**
|
2014-11-29 10:11:35 +00:00
|
|
|
* To learn more about how form events work check the documentation
|
2015-02-18 07:05:44 +00:00
|
|
|
* entry at {@link http://symfony.com/doc/any/components/form/form_events.html}.
|
2014-11-29 10:11:35 +00:00
|
|
|
*
|
|
|
|
* To learn how to dynamically modify forms using events check the cookbook
|
2015-02-18 07:05:44 +00:00
|
|
|
* entry at {@link http://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}.
|
2014-11-29 10:11:35 +00:00
|
|
|
*
|
2012-05-26 08:48:33 +01:00
|
|
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
2011-05-30 08:19:21 +01:00
|
|
|
*/
|
|
|
|
final class FormEvents
|
|
|
|
{
|
2014-10-23 13:21:59 +01:00
|
|
|
/**
|
2014-11-17 13:53:37 +00:00
|
|
|
* The PRE_SUBMIT event is dispatched at the beginning of the Form::submit() method.
|
|
|
|
*
|
|
|
|
* It can be used to:
|
|
|
|
* - Change data from the request, before submitting the data to the form.
|
|
|
|
* - Add or remove form fields, before submitting the data to the form.
|
|
|
|
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
|
|
|
|
*
|
2014-10-23 13:21:59 +01:00
|
|
|
* @Event
|
|
|
|
*/
|
2013-04-20 16:32:55 +01:00
|
|
|
const PRE_SUBMIT = 'form.pre_bind';
|
2011-05-30 08:19:21 +01:00
|
|
|
|
2014-10-23 13:21:59 +01:00
|
|
|
/**
|
2014-11-17 13:53:37 +00:00
|
|
|
* The SUBMIT event is dispatched just before the Form::submit() method
|
|
|
|
* transforms back the normalized data to the model and view data.
|
|
|
|
*
|
|
|
|
* It can be used to change data from the normalized representation of the data.
|
|
|
|
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
|
|
|
|
*
|
2014-10-23 13:21:59 +01:00
|
|
|
* @Event
|
|
|
|
*/
|
2013-04-20 16:32:55 +01:00
|
|
|
const SUBMIT = 'form.bind';
|
2012-05-23 19:58:42 +01:00
|
|
|
|
2014-10-23 13:21:59 +01:00
|
|
|
/**
|
2014-11-17 13:53:37 +00:00
|
|
|
* The FormEvents::POST_SUBMIT event is dispatched after the Form::submit()
|
|
|
|
* once the model and view data have been denormalized.
|
|
|
|
*
|
|
|
|
* It can be used to fetch data after denormalization.
|
|
|
|
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
|
|
|
|
*
|
2014-10-23 13:21:59 +01:00
|
|
|
* @Event
|
|
|
|
*/
|
2013-04-20 16:32:55 +01:00
|
|
|
const POST_SUBMIT = 'form.post_bind';
|
2011-05-30 08:19:21 +01:00
|
|
|
|
2014-10-23 13:21:59 +01:00
|
|
|
/**
|
2014-11-17 13:53:37 +00:00
|
|
|
* The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method.
|
|
|
|
*
|
|
|
|
* It can be used to:
|
|
|
|
* - Modify the data given during pre-population;
|
|
|
|
* - Modify a form depending on the pre-populated data (adding or removing fields dynamically).
|
|
|
|
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
|
|
|
|
*
|
2014-10-23 13:21:59 +01:00
|
|
|
* @Event
|
|
|
|
*/
|
2011-05-30 08:19:21 +01:00
|
|
|
const PRE_SET_DATA = 'form.pre_set_data';
|
|
|
|
|
2014-10-23 13:21:59 +01:00
|
|
|
/**
|
2014-11-17 13:53:37 +00:00
|
|
|
* The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method.
|
|
|
|
*
|
|
|
|
* This event is mostly here for reading data after having pre-populated the form.
|
|
|
|
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
|
|
|
|
*
|
2014-10-23 13:21:59 +01:00
|
|
|
* @Event
|
|
|
|
*/
|
2011-05-30 08:19:21 +01:00
|
|
|
const POST_SET_DATA = 'form.post_set_data';
|
|
|
|
|
2013-04-20 16:32:55 +01:00
|
|
|
/**
|
|
|
|
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
|
|
|
|
* {@link PRE_SUBMIT} instead.
|
2014-10-23 13:21:59 +01:00
|
|
|
*
|
|
|
|
* @Event
|
2013-04-20 16:32:55 +01:00
|
|
|
*/
|
|
|
|
const PRE_BIND = 'form.pre_bind';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
|
|
|
|
* {@link SUBMIT} instead.
|
2014-10-23 13:21:59 +01:00
|
|
|
*
|
|
|
|
* @Event
|
2013-04-20 16:32:55 +01:00
|
|
|
*/
|
|
|
|
const BIND = 'form.bind';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
|
|
|
|
* {@link POST_SUBMIT} instead.
|
2014-10-23 13:21:59 +01:00
|
|
|
*
|
|
|
|
* @Event
|
2013-04-20 16:32:55 +01:00
|
|
|
*/
|
|
|
|
const POST_BIND = 'form.post_bind';
|
|
|
|
|
2012-05-23 19:58:42 +01:00
|
|
|
private function __construct()
|
|
|
|
{
|
|
|
|
}
|
2011-05-30 08:19:21 +01:00
|
|
|
}
|