StateChangeEvent.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\persistence;
12 
15 
16 /**
17  * StateChangeEvent signals a change of the state of
18  * a PersistentObject instance.
19  *
20  * @author ingo herwig <ingo@wemove.com>
21  */
22 class StateChangeEvent extends Event {
23 
24  const NAME = __CLASS__;
25 
26  private $object = null;
27  private $oldValue = null;
28  private $newValue = null;
29 
30  /**
31  * Constructor.
32  * @param $object PersistentObject instance
33  * @param $oldValue The old value of the state.
34  * @param $newValue The new value of the state.
35  */
36  public function __construct(PersistentObject $object, $oldValue, $newValue) {
37  $this->object = $object;
38  $this->oldValue = $oldValue;
39  $this->newValue = $newValue;
40  }
41 
42  /**
43  * Get the object whose state has changed.
44  * @return PersistentObject instance
45  */
46  public function getObject() {
47  return $this->object;
48  }
49 
50  /**
51  * Get the old value.
52  * @return Mixed
53  */
54  public function getOldValue() {
55  return $this->oldValue;
56  }
57 
58  /**
59  * Get the new value.
60  * @return Mixed
61  */
62  public function getNewValue() {
63  return $this->newValue;
64  }
65 }
66 ?>
getObject()
Get the object whose state has changed.
Persistence layer related interfaces and classes.
Definition: namespaces.php:42
Event is the base class for all events.
Definition: Event.php:18
StateChangeEvent signals a change of the state of a PersistentObject instance.
__construct(PersistentObject $object, $oldValue, $newValue)
Constructor.
PersistentObject defines the interface of all persistent objects.