FormEvent.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Form;
  11. use Symfony\Component\EventDispatcher\Event;
  12. /**
  13. * @author Bernhard Schussek <bschussek@gmail.com>
  14. */
  15. class FormEvent extends Event
  16. {
  17. private $form;
  18. protected $data;
  19. public function __construct(FormInterface $form, $data)
  20. {
  21. $this->form = $form;
  22. $this->data = $data;
  23. }
  24. /**
  25. * Returns the form at the source of the event.
  26. *
  27. * @return FormInterface
  28. */
  29. public function getForm()
  30. {
  31. return $this->form;
  32. }
  33. /**
  34. * Returns the data associated with this event.
  35. *
  36. * @return mixed
  37. */
  38. public function getData()
  39. {
  40. return $this->data;
  41. }
  42. /**
  43. * Allows updating with some filtered data.
  44. *
  45. * @param mixed $data
  46. */
  47. public function setData($data)
  48. {
  49. $this->data = $data;
  50. }
  51. }