PropertyChangeEvent.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 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 A reference to the PersistentObject object 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 ?>
getObject()
Get the object whose property has changed.
Persistence layer related interfaces and classes.
Definition: namespaces.php:42
getPropertyName()
Get the name of the property that has changed.
__construct(PersistentObject $object, $name, $oldValue, $newValue)
Constructor.
PropertyChangeEvent signals a change of a property of a PersistentObject instance.
Event is the base class for all events.
Definition: Event.php:18
PersistentObject defines the interface of all persistent objects.