Overview

Namespaces

  • DcGeneral
    • Clipboard
    • Contao
      • Callback
      • Compatibility
      • DataDefinition
        • Definition
      • Dca
        • Builder
          • Legacy
        • Definition
        • Palette
        • Populator
      • Event
      • View
        • Contao2BackendView
          • Event
    • Controller
    • Data
    • DataDefinition
      • Builder
      • Definition
        • Properties
        • View
          • Panel
      • ModelRelationship
      • Palette
        • Builder
          • Event
        • Condition
          • Palette
          • Property
    • EnvironmentPopulator
    • Event
    • Exception
    • Factory
      • Event
    • Panel
    • View
      • Event

Classes

  • AbstractCommandEvent
  • AbstractContainerAwareEvent
  • AbstractEnvironmentAwareEvent
  • AbstractModelAwareEvent
  • AbstractModelCommandEvent
  • AbstractViewAwareEvent
  • EventPropagator
  • PostCreateModelEvent
  • PostDeleteModelEvent
  • PostDuplicateModelEvent
  • PostPasteModelEvent
  • PostPersistModelEvent
  • PreCreateModelEvent
  • PreDeleteModelEvent
  • PreDuplicateModelEvent
  • PrePasteModelEvent
  • PrePersistModelEvent

Interfaces

  • CommandEventInterface
  • EventPropagatorInterface
  • ModelCommandEventInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 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: 
18: /**
19:  * This event is emitted just before a model is saved to the data provider.
20:  *
21:  * @package DcGeneral\Event
22:  */
23: class PrePersistModelEvent extends AbstractModelAwareEvent
24: {
25:     const NAME = 'dc-general.model.pre-persist';
26: 
27:     /**
28:      * The original model attached to the event.
29:      *
30:      * @var ModelInterface|null
31:      */
32:     protected $originalModel;
33: 
34:     /**
35:      * Create a new model aware event.
36:      *
37:      * @param EnvironmentInterface $environment   The environment.
38:      *
39:      * @param ModelInterface       $model         The model attached to the event.
40:      *
41:      * @param ModelInterface|null  $originalModel The original state of the model (persistent in the data provider).
42:      */
43:     public function __construct(EnvironmentInterface $environment, ModelInterface $model, ModelInterface $originalModel = null)
44:     {
45:         parent::__construct($environment, $model);
46: 
47:         $this->originalModel = $originalModel;
48:     }
49: 
50:     /**
51:      * Return the original state of the model.
52:      * May be null on create.
53:      *
54:      * @return ModelInterface|null
55:      */
56:     public function getOriginalModel()
57:     {
58:         return $this->originalModel;
59:     }
60: }
61: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0