1: <?php
2: /**
3: * PHP version 5
4: *
5: * @package generalDriver
6: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
7: * @author Stefan Heimes <stefan_heimes@hotmail.com>
8: * @author Tristan Lins <tristan.lins@bit3.de>
9: * @copyright The MetaModels team.
10: * @license LGPL.
11: * @filesource
12: */
13:
14: namespace DcGeneral\Contao\Compatibility;
15:
16: use DcGeneral\Data\ModelInterface;
17: use DcGeneral\DC_General;
18: use DcGeneral\Exception\DcGeneralRuntimeException;
19: use DcGeneral\Factory\Event\PopulateEnvironmentEvent;
20:
21: /**
22: * Class ActiveRecord
23: *
24: * Small compatibility layer for the $dc->activeRecord property.
25: */
26: class ActiveRecord
27: {
28: /**
29: * The underlying model.
30: *
31: * @var ModelInterface
32: */
33: protected $model;
34:
35: public function __construct(ModelInterface $model)
36: {
37: $this->model = $model;
38: }
39:
40: /**
41: * {@inheritdoc}
42: */
43: function __get($name)
44: {
45: return $this->model->getProperty($name);
46: }
47:
48: /**
49: * {@inheritdoc}
50: */
51: function __set($name, $value)
52: {
53: $this->model->setProperty($name, $value);
54: }
55:
56: /**
57: * Return the underlying model.
58: *
59: * @return \DcGeneral\Data\ModelInterface
60: */
61: public function getModel()
62: {
63: return $this->model;
64: }
65: }
66: