CustomType
extends ObjAttribute
in package
Attribute to override the default database column type.
Allows specifying custom SQL types for fields that don't map to standard types.
Usage:
#[CustomType('ENUM("pending", "active", "archived")')]
public string $status;
Tags
Table of Contents
Properties
- $dbType : string
Methods
- __construct() : mixed
- Initialize the custom type attribute.
- of() : static|false
- Extract an attribute instance from a reflected property.
Properties
$dbType
public
string
$dbType
Methods
__construct()
Initialize the custom type attribute.
public
__construct(string $dbType) : mixed
Parameters
- $dbType : string
-
The SQL type specification (e.g., 'ENUM(...)', 'DECIMAL(10,2)').
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.