phpEZ v0.1.2

UniqueMulti extends ObjAttribute
in package

Attribute to create a composite (multi-column) UNIQUE constraint.

Multiple fields sharing the same $indexName are combined into a single UNIQUE index during DDL generation.

Usage:

#[UniqueMulti('idx_user_role')]
public int $user_id;
#[UniqueMulti('idx_user_role')]
public string $role;
Tags
subpackage

db

see
Model::ddl()

Table of Contents

Properties

$indexName  : string

Methods

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

Properties

$indexName

public string $indexName

Methods

__construct()

Initialize the composite unique index attribute.

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

The name of the shared unique index. Must not be empty.

Tags
throws
InvalidArgumentException

If indexName is empty.

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