1 | <?php |
||
19 | class PreUpdateEventArgs extends LifecycleEventArgs |
||
20 | { |
||
21 | /** @var array */ |
||
22 | private $documentChangeSet; |
||
23 | |||
24 | 236 | public function __construct(object $document, DocumentManager $dm, array $changeSet) |
|
32 | |||
33 | public function getDocumentChangeSet() : array |
||
37 | |||
38 | 1 | public function hasChangedField(string $field) : bool |
|
42 | |||
43 | /** |
||
44 | * Gets the old value of the changeset of the changed field. |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | public function getOldValue(string $field) |
||
54 | |||
55 | /** |
||
56 | * Gets the new value of the changeset of the changed field. |
||
57 | * |
||
58 | * @return mixed |
||
59 | */ |
||
60 | public function getNewValue(string $field) |
||
66 | |||
67 | /** |
||
68 | * Sets the new value of this field. |
||
69 | * |
||
70 | * @param mixed $value |
||
71 | */ |
||
72 | 1 | public function setNewValue(string $field, $value) : void |
|
79 | |||
80 | /** |
||
81 | * Asserts the field exists in changeset. |
||
82 | * |
||
83 | * @throws InvalidArgumentException If the field has no changeset. |
||
84 | */ |
||
85 | 1 | private function assertValidField(string $field) : void |
|
95 | } |
||
96 |
If you suppress an error, we recommend checking for the error condition explicitly: