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