PropertyChangeEvent.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  * PropertyChangeEvent signals a change of a property of
18  * a PersistentObject instance.
19  *
20  * @author ingo herwig <ingo@wemove.com>
21  */
22 class PropertyChangeEvent extends Event {
23 
24  const NAME = __CLASS__;
25 
26  private $object = null;
27  private $name = null;
28  private $oldValue = null;
29  private $newValue = null;
30 
31  /**
32  * Constructor.
33  * @param $object PersistentObject instance that whose property has changed.
34  * @param $name The name of the property that has changed.
35  * @param $oldValue The old value of the property that has changed.
36  * @param $newValue The new value of the property that has changed.
37  */
38  public function __construct(PersistentObject $object, $name, $oldValue, $newValue) {
39  $this->object = $object;
40  $this->name = $name;
41  $this->oldValue = $oldValue;
42  $this->newValue = $newValue;
43  }
44 
45  /**
46  * Get the object whose property has changed.
47  * @return PersistentObject instance
48  */
49  public function getObject() {
50  return $this->object;
51  }
52 
53  /**
54  * Get the name of the property that has changed.
55  * @return String
56  */
57  public function getPropertyName() {
58  return $this->name;
59  }
60 
61  /**
62  * Get the old value.
63  * @return Mixed
64  */
65  public function getOldValue() {
66  return $this->oldValue;
67  }
68 
69  /**
70  * Get the new value.
71  * @return Mixed
72  */
73  public function getNewValue() {
74  return $this->newValue;
75  }
76 }
77 ?>
PropertyChangeEvent signals a change of a property of a PersistentObject instance.
Persistence layer related interfaces and classes.
Definition: namespaces.php:42
Event is the base class for all events.
Definition: Event.php:18
getPropertyName()
Get the name of the property that has changed.
getObject()
Get the object whose property has changed.
PersistentObject defines the interface of all persistent objects.
__construct(PersistentObject $object, $name, $oldValue, $newValue)
Constructor.