Documentation

PreUpdateEventArgs extends LifecycleEventArgs
in package

Class that holds event arguments for a preUpdate event.

Tags
template-covariant

TObjectManager of ObjectManager

extends

LifecycleEventArgs<TObjectManager>

Table of Contents

Properties

$_emptyEventArgsInstance  : EventArgs|null
Single instance of EventArgs.
$entityChangeSet  : array<string, array<int, mixed>>
$object  : object
$objectManager  : ObjectManager

Methods

__construct()  : mixed
getEmptyInstance()  : EventArgs
Gets the single, empty and immutable EventArgs instance.
getEntityChangeSet()  : array<string, array<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|null $_emptyEventArgsInstance

Methods

__construct()

public __construct(object $entity, ObjectManager $objectManager, array<string, array<int, mixed>> &$changeSet) : mixed
Parameters
$entity : object
$objectManager : ObjectManager
$changeSet : array<string, array<int, mixed>>
Tags
psalm-param

TObjectManager $objectManager

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
link
https://msdn.microsoft.com/en-us/library/system.eventargs.aspx
see
EventManager::dispatchEvent
Return values
EventArgs

getEntityChangeSet()

Retrieves the entity changeset.

public getEntityChangeSet() : array<string, array<int, mixed>>
Return values
array<string, array<int, mixed>>

getNewValue()

Gets the new value of the changeset of the changed field.

public getNewValue(string $field) : mixed
Parameters
$field : string

getObject()

Retrieves the associated object.

public getObject() : object
Return values
object

getOldValue()

Gets the old value of the changeset of the changed field.

public getOldValue(string $field) : mixed
Parameters
$field : string

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

assertValidField()

Asserts the field exists in changeset.

private assertValidField(string $field) : void
Parameters
$field : string
Tags
throws
InvalidArgumentException

        
On this page

Search results