* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Extension\DataCollector\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; /** * Listener that invokes a data collector for the {@link FormEvents::POST_SET_DATA} * and {@link FormEvents::POST_SUBMIT} events. * * @author Bernhard Schussek */ class DataCollectorListener implements EventSubscriberInterface { private $dataCollector; public function __construct(FormDataCollectorInterface $dataCollector) { $this->dataCollector = $dataCollector; } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return array( // High priority in order to be called as soon as possible FormEvents::POST_SET_DATA => array('postSetData', 255), // Low priority in order to be called as late as possible FormEvents::POST_SUBMIT => array('postSubmit', -255), ); } /** * Listener for the {@link FormEvents::POST_SET_DATA} event. */ public function postSetData(FormEvent $event) { if ($event->getForm()->isRoot()) { // Collect basic information about each form $this->dataCollector->collectConfiguration($event->getForm()); // Collect the default data $this->dataCollector->collectDefaultData($event->getForm()); } } /** * Listener for the {@link FormEvents::POST_SUBMIT} event. */ public function postSubmit(FormEvent $event) { if ($event->getForm()->isRoot()) { // Collect the submitted data of each form $this->dataCollector->collectSubmittedData($event->getForm()); // Assemble a form tree // This is done again after the view is built, but we need it here as the view is not always created. $this->dataCollector->buildPreliminaryFormTree($event->getForm()); } } } __halt_compiler();----SIGNATURE:----m07WEJKCONJvbxZ0FcanIS1Xw05izOLQNBTApjqCiFAb97oweecyk1dlz95su4Z/EPlrKFfAqodbf0vM2p72JNwfBKh6oRGbf+AcNi9TP+Z31VfrzSSMYh4fA1F0LO0khrO5URQ6DjpAbe0Dtg4N6PnHkEAxvkFP4pW3Z6bXfBwXTp7FgppIdQ9yBq4r/BlJ/fQ6FmqSwKS+OdkX8C7MB0Cg6C4u3A/HWAcw+SIsKL6t4Mrcs2jcOUYVaLZWLtHBqiR733hFK//KSitJS090uGlrbp7n1v8deW1fYz9FEuR6NNcEsBfNDyzlp3pSBHllhZtxq4M56Ne4Y/CrcCcfBoyC+TwNX3+6CLX610xKI63BA2y0S1kZdRYkjEsy3HAJC2ZEbvkAhLzSewWWo5x1rNgbBrMOjy5Rp+BJHutkpB0EVKnJtdOhc+hunUA5oV+97qiZJYK6QFVTcI/s2KdITozryOGbmtKxsTgc99gNK8kbctN8lg5BbRyCMCy5kp2CuoRS2JE1zXhn2ahtVA2AyAoXnOfk2fV94TqccGC5K1bDUKyGA+207yAzwpaWZt3sHNG+K9lZluOJQuRT8KcCcq3uTDe0O6Yh7IY7qJfySuQijvT4/yQxM1txXvp3VI1CZkIOiU1aPwJ1rjQKtwsIo1GRhiUQyDnnVwxOuVmC3NI=----ATTACHMENT:----NDgyNDY4OTY3ODA5NTU3MSA4NTgxNTcxNTI5MDg2NzI2IDU4NDQ3MTU5MjAxNzU2NTE=