Oihana PHP

NoticeType uses ConstantsTrait

Enumeration of the model's notice types.

Each constant is the type identifier carried by a notice notices payload when a model emits a lifecycle event. The values are paired around every CRUD verb (delete, insert, replace, truncate, update, upsert) with a before* and an after* variant:

  • before* types are emitted before the operation runs, so observers can inspect or veto the document that is about to change.
  • after* types are emitted once the operation has completed, carrying the resulting document(s).

Always reference these constants instead of the raw string so that a routing or filtering layer keeps working if a value ever changes (no magic strings).

Example:

use oihana\models\enums\NoticeType;
use oihana\models\notices\AfterUpdate;

$notice = new AfterUpdate( data: $result, target: $this, context: $init );

if ( $notice->type === NoticeType::AFTER_UPDATE )
{
    // react to a completed update
}
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0
see
notices

For the notice payload classes that use these types.

signals

For the signals that emit the notices.

Table of Contents

Constants

AFTER_DELETE  : string = 'afterDelete'
Emitted after a document has been deleted.
AFTER_INSERT  : string = 'afterInsert'
Emitted after a document has been inserted.
AFTER_REPLACE  : string = 'afterReplace'
Emitted after a document has been replaced.
AFTER_TRUNCATE  : string = 'afterTruncate'
Emitted after a collection has been truncated.
AFTER_UPDATE  : string = 'afterUpdate'
Emitted after a document has been updated.
AFTER_UPSERT  : string = 'afterUpsert'
Emitted after a document has been upserted (inserted or updated).
BEFORE_DELETE  : string = 'beforeDelete'
Emitted before a document is deleted.
BEFORE_INSERT  : string = 'beforeInsert'
Emitted before a document is inserted.
BEFORE_REPLACE  : string = 'beforeReplace'
Emitted before a document is replaced.
BEFORE_TRUNCATE  : string = 'beforeTruncate'
Emitted before a collection is truncated.
BEFORE_UPDATE  : string = 'beforeUpdate'
Emitted before a document is updated.
BEFORE_UPSERT  : string = 'beforeUpsert'
Emitted before a document is upserted (inserted or updated).

Constants

AFTER_DELETE

Emitted after a document has been deleted.

public string AFTER_DELETE = 'afterDelete'

AFTER_INSERT

Emitted after a document has been inserted.

public string AFTER_INSERT = 'afterInsert'

AFTER_REPLACE

Emitted after a document has been replaced.

public string AFTER_REPLACE = 'afterReplace'

AFTER_TRUNCATE

Emitted after a collection has been truncated.

public string AFTER_TRUNCATE = 'afterTruncate'

AFTER_UPDATE

Emitted after a document has been updated.

public string AFTER_UPDATE = 'afterUpdate'

AFTER_UPSERT

Emitted after a document has been upserted (inserted or updated).

public string AFTER_UPSERT = 'afterUpsert'

BEFORE_DELETE

Emitted before a document is deleted.

public string BEFORE_DELETE = 'beforeDelete'

BEFORE_INSERT

Emitted before a document is inserted.

public string BEFORE_INSERT = 'beforeInsert'

BEFORE_REPLACE

Emitted before a document is replaced.

public string BEFORE_REPLACE = 'beforeReplace'

BEFORE_TRUNCATE

Emitted before a collection is truncated.

public string BEFORE_TRUNCATE = 'beforeTruncate'

BEFORE_UPDATE

Emitted before a document is updated.

public string BEFORE_UPDATE = 'beforeUpdate'

BEFORE_UPSERT

Emitted before a document is upserted (inserted or updated).

public string BEFORE_UPSERT = 'beforeUpsert'
On this page

Search results