vendor/contao-community-alliance/dc-general/src/Event/AbstractModelAwareEvent.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of contao-community-alliance/dc-general.
  4.  *
  5.  * (c) 2013-2019 Contao Community Alliance.
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  *
  10.  * This project is provided in good faith and hope to be usable by anyone.
  11.  *
  12.  * @package    contao-community-alliance/dc-general
  13.  * @author     Christian Schiffler <c.schiffler@cyberspectrum.de>
  14.  * @author     Tristan Lins <tristan.lins@bit3.de>
  15.  * @author     Sven Baumann <baumann.sv@gmail.com>
  16.  * @copyright  2013-2019 Contao Community Alliance.
  17.  * @license    https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
  18.  * @filesource
  19.  */
  20. namespace ContaoCommunityAlliance\DcGeneral\Event;
  21. use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface;
  22. use ContaoCommunityAlliance\DcGeneral\EnvironmentInterface;
  23. use ContaoCommunityAlliance\DcGeneral\ModelAwareInterface;
  24. /**
  25.  * Abstract base class for an event that need an environment and a model.
  26.  *
  27.  * @SuppressWarnings(PHPMD.NumberOfChildren)
  28.  */
  29. class AbstractModelAwareEvent extends AbstractEnvironmentAwareEvent implements ModelAwareInterface
  30. {
  31.     /**
  32.      * The model attached to the event.
  33.      *
  34.      * @var ModelInterface
  35.      */
  36.     protected $model;
  37.     /**
  38.      * Create a new model aware event.
  39.      *
  40.      * @param EnvironmentInterface $environment The environment.
  41.      * @param ModelInterface       $model       The model attached to the event.
  42.      */
  43.     public function __construct(EnvironmentInterface $environmentModelInterface $model)
  44.     {
  45.         parent::__construct($environment);
  46.         $this->model $model;
  47.     }
  48.     /**
  49.      * {@inheritdoc}
  50.      */
  51.     public function getModel()
  52.     {
  53.         return $this->model;
  54.     }
  55. }