phpEZ v0.4.1

OnUpdate extends ObjAttribute
in package

Attribute to specify ON UPDATE behavior for a database column.

Typically used with timestamp columns that auto-update on row modification.

Usage:

#[OnUpdate('CURRENT_TIMESTAMP')]
public DBDateTime $updated_at;
Tags
see
Model::ddl()
subpackage

db

Attributes
#[Attribute]
\Attribute::TARGET_PROPERTY

Table of Contents

Properties

$action  : string

Methods

__construct()  : mixed
Initialize the ON UPDATE attribute.
of()  : static|false
Extract an attribute instance from a reflected property.

Properties

$action

public string $action

Methods

__construct()

Initialize the ON UPDATE attribute.

public __construct(string $action) : mixed
Parameters
$action : string

The SQL action to perform on update (e.g., 'CURRENT_TIMESTAMP').

of()

Extract an attribute instance from a reflected property.

public static of(ReflectionProperty $field) : static|false

Searches the property's attributes for one matching this class name and instantiates it with the attribute's arguments.

Parameters
$field : ReflectionProperty

The property to inspect for attributes.

Return values
static|false

The attribute instance if found, false otherwise.

On this page

Search results