Name
extends Message
in package
Table of Contents
- ALL_OPS = 0b11111111
- Bitmask for all the OP_ constants.
- F_API = 2 ** 30
- Set when the request came from the JSON API.
- F_VALIDATE = 2 ** 29
- Set on a request to validate the message.
- OP_ADD = 1
- OP_BATCH = 2 ** 6
- OP_CREATE = 2
- OP_DELETE = 2 ** 2
- OP_GET = 2 ** 3
- OP_LOCK = 2 ** 7
- OP_QUERY = 2 ** 4
- OP_UPDATE = 2 ** 5
- $exclude : bool
- $language : string
- $like : bool
- $name : string
- $ownerUuid : string
- __construct() : mixed
- applyTo() : void
- Add, update, or delete this name from/to a model
- copy() : $this
- Selectively copy information from a data array.
- fromArray() : static
- Populate the message with data from an array of request data.
- fromRequest() : static
- Create a message from the request payload, bypassing some middleware.
- fromRequestList() : array<string|int, Name>
- Populate an array of names with request data.
- getOpFlags() : int
- toOpFlags() : int
- Convert a method name to an operation bitmask.
- validate() : self
- Check the message for validity.
Constants
ALL_OPS
Bitmask for all the OP_ constants.
public
mixed
ALL_OPS
= 0b11111111
F_API
Set when the request came from the JSON API.
public
mixed
F_API
= 2 ** 30
F_VALIDATE
Set on a request to validate the message.
public
mixed
F_VALIDATE
= 2 ** 29
OP_ADD
public
mixed
OP_ADD
= 1
OP_BATCH
public
mixed
OP_BATCH
= 2 ** 6
OP_CREATE
public
mixed
OP_CREATE
= 2
OP_DELETE
public
mixed
OP_DELETE
= 2 ** 2
OP_GET
public
mixed
OP_GET
= 2 ** 3
OP_LOCK
public
mixed
OP_LOCK
= 2 ** 7
OP_QUERY
public
mixed
OP_QUERY
= 2 ** 4
OP_UPDATE
public
mixed
OP_UPDATE
= 2 ** 5
Properties
$exclude
public
bool
$exclude
= false
The Name/language should be excluded from results. Used for queries.
$language
public
string
$language
The language this name is in.
$like
public
bool
$like
= false
The Name/language are in SQL "like" form. Used for queries.
$name
public
string
$name
The value of this name.
$ownerUuid
public
string
$ownerUuid
The entity this name is attached to.
Methods
__construct()
public
__construct([string|null $name = null ][, string|null $language = null ][, string|null $ownerUuid = null ]) : mixed
Parameters
- $name : string|null = null
- $language : string|null = null
- $ownerUuid : string|null = null
Return values
mixed —applyTo()
Add, update, or delete this name from/to a model
public
applyTo(Model $owner) : void
Parameters
- $owner : Model
Return values
void —copy()
Selectively copy information from a data array.
public
copy(array<string|int, mixed> $data, int $opFlags) : $this
Parameters
- $data : array<string|int, mixed>
- $opFlags : int
Return values
$this —fromArray()
Populate the message with data from an array of request data.
public
static fromArray(array<string|int, mixed> $data[, int $opFlags = self::OP_ADD ]) : static
Parameters
- $data : array<string|int, mixed>
-
Data generated by the request.
- $opFlags : int = self::OP_ADD
-
Bitmask of the request operation (may include FM_VALIDATE)
Tags
Return values
static —Message initialized with relevant data.
fromRequest()
Create a message from the request payload, bypassing some middleware.
public
static fromRequest(Request $request, int $opFlags) : static
Parameters
- $request : Request
- $opFlags : int
Tags
Return values
static —fromRequestList()
Populate an array of names with request data.
public
static fromRequestList(array<string|int, mixed> $data, int $opFlags, int $minimum) : array<string|int, Name>
Parameters
- $data : array<string|int, mixed>
-
Data generated by the request.
- $opFlags : int
-
Bitmask of the request operation (may include FM_VALIDATE)
- $minimum : int
-
the minimum number of elements that should be present.
Tags
Return values
array<string|int, Name> —getOpFlags()
public
getOpFlags() : int
Return values
int —toOpFlags()
Convert a method name to an operation bitmask.
public
static toOpFlags(string $method[, array<string|int, mixed> $options = [] ]) : int
Parameters
- $method : string
-
The method name.
- $options : array<string|int, mixed> = []
-
Options are: add Bitmask of flags to add to the result. allowZero boolean, if not set an exception is thrown when there is no matching flag. disallow Bitmask of methods to ignore.
Tags
Return values
int —Operation bitmask, zero if not recognized or disallowed.
validate()
Check the message for validity.
public
validate([int|null $opFlags = null ]) : self
Parameters
- $opFlags : int|null = null
-
Operation bitmask.