1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Event;
14:
15: use DcGeneral\Data\ModelInterface;
16: use DcGeneral\EnvironmentInterface;
17: use DcGeneral\ModelAwareInterface;
18:
19: /**
20: * Abstract base class for an event that need an environment and a model.
21: *
22: * @package DcGeneral\Event
23: */
24: class AbstractModelAwareEvent
25: extends AbstractEnvironmentAwareEvent
26: implements ModelAwareInterface
27: {
28: /**
29: * The model attached to the event.
30: *
31: * @var ModelInterface
32: */
33: protected $model;
34:
35: /**
36: * Create a new model aware event.
37: *
38: * @param EnvironmentInterface $environment The environment.
39: *
40: * @param ModelInterface $model The model attached to the event.
41: */
42: public function __construct(EnvironmentInterface $environment, ModelInterface $model)
43: {
44: parent::__construct($environment);
45: $this->model = $model;
46: }
47:
48: /**
49: * {@inheritdoc}
50: */
51: public function getModel()
52: {
53: return $this->model;
54: }
55: }
56: