PreUpdateEventArgs
extends LifecycleEventArgs
in package
Class that holds event arguments for a preUpdate event.
Table of Contents
- $_emptyEventArgsInstance : EventArgs
- Single instance of EventArgs.
- $entityChangeSet : array<string|int, array<string|int, mixed>>
- $object : object
- $objectManager : ObjectManager
- __construct() : mixed
- getEmptyInstance() : EventArgs
- Gets the single, empty and immutable EventArgs instance.
- getEntity() : object
- Retrieves the associated entity.
- getEntityChangeSet() : array<string|int, array<string|int, mixed>>
- Retrieves the entity changeset.
- getNewValue() : mixed
- Gets the new value of the changeset of the changed field.
- getObject() : object
- Retrieves the associated object.
- getObjectManager() : ObjectManager
- Retrieves the associated ObjectManager.
- getOldValue() : mixed
- Gets the old value of the changeset of the changed field.
- hasChangedField() : bool
- Checks if field has a changeset.
- setNewValue() : void
- Sets the new value of this field.
- assertValidField() : void
- Asserts the field exists in changeset.
Properties
$_emptyEventArgsInstance
Single instance of EventArgs.
private
static EventArgs
$_emptyEventArgsInstance
$entityChangeSet
private
array<string|int, array<string|int, mixed>>
$entityChangeSet
$object
private
object
$object
$objectManager
private
ObjectManager
$objectManager
Methods
__construct()
public
__construct(object $entity, ObjectManager $objectManager, array<string|int, array<string|int, mixed>> &$changeSet) : mixed
Parameters
- $entity : object
- $objectManager : ObjectManager
- $changeSet : array<string|int, array<string|int, mixed>>
Return values
mixed —getEmptyInstance()
Gets the single, empty and immutable EventArgs instance.
public
static getEmptyInstance() : EventArgs
This instance will be used when events are dispatched without any parameter, like this: EventManager::dispatchEvent('eventname');
The benefit from this is that only one empty instance is instantiated and shared (otherwise there would be instances for every dispatched in the abovementioned form).
Tags
Return values
EventArgs —getEntity()
Retrieves the associated entity.
public
getEntity() : object
Tags
Return values
object —getEntityChangeSet()
Retrieves the entity changeset.
public
getEntityChangeSet() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —getNewValue()
Gets the new value of the changeset of the changed field.
public
getNewValue(string $field) : mixed
Parameters
- $field : string
Return values
mixed —getObject()
Retrieves the associated object.
public
getObject() : object
Return values
object —getObjectManager()
Retrieves the associated ObjectManager.
public
getObjectManager() : ObjectManager
Return values
ObjectManager —getOldValue()
Gets the old value of the changeset of the changed field.
public
getOldValue(string $field) : mixed
Parameters
- $field : string
Return values
mixed —hasChangedField()
Checks if field has a changeset.
public
hasChangedField(string $field) : bool
Parameters
- $field : string
Return values
bool —setNewValue()
Sets the new value of this field.
public
setNewValue(string $field, mixed $value) : void
Parameters
- $field : string
- $value : mixed
Return values
void —assertValidField()
Asserts the field exists in changeset.
private
assertValidField(string $field) : void
Parameters
- $field : string