Documentation

PreUpdateEventArgs extends LifecycleEventArgs
in package

Class that holds event arguments for a preUpdate event.

Table of Contents

Properties

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

Methods

__construct()  : mixed
getEmptyInstance()  : EventArgs
Gets the single, empty and immutable EventArgs instance.
getEntity()  : object
Retrieves associated Entity.
getEntityChangeSet()  : array<string|int, array<string|int, mixed>>
Retrieves entity changeset.
getEntityManager()  : EntityManagerInterface
Retrieves associated EntityManager.
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, EntityManagerInterface $em, array<string|int, array<string|int, mixed>> &$changeSet) : mixed
Parameters
$entity : object
$em : EntityManagerInterface
$changeSet : array<string|int, array<string|int, mixed>>
Tags
psalm-param

array<string, array{mixed, mixed}|PersistentCollection> $changeSet

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

getEntity()

Retrieves associated Entity.

public getEntity() : object
Tags
deprecated
2.13.

Use getObject instead.

Return values
object

getEntityChangeSet()

Retrieves entity changeset.

public getEntityChangeSet() : array<string|int, array<string|int, mixed>>
Tags
psalm-return

array<string, array{mixed, mixed}|PersistentCollection>

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

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