FieldAccess
in package
Field tier: who receives the field (`read`), who may fill it in when creating (`insert`) and who may change it on an existing record (`update`, including `updateColumn(s)`).
A field without the attribute behaves as all/all/all. A stripped field keeps its stored
value: the DB value on update, the constructor default on insert. A stripped insert field is
therefore safe only when the manager fills the server-computed value itself.
IMPORTANT: all three axes are required, with no defaults. Otherwise a forgotten axis cannot
be told from an intended one and stays silently open.
NOTE: read is enforced on both paths. On the write axes only Audience::None applies
everywhere; other audiences are enforced on the external save only, and Audience::Owner
is treated as Audience::Privileged there. updateCheck (contract of
ConditionallyUpdatable) is reserved for owner checks and not evaluated yet.
Usage:
#[FieldAccess(read: Audience::Privileged, insert: Audience::Privileged, update: Audience::None)]
protected ?string $settings = null;
Tags
Attributes
- #[Attribute]
- \Attribute::TARGET_PROPERTY
Table of Contents
Properties
Methods
- __construct() : mixed
Properties
$insert read-only
public
Audience
$insert
$read read-only
public
Audience
$read
$update read-only
public
Audience
$update
$updateCheck read-only
public
string|null
$updateCheck
= null
Methods
__construct()
public
__construct(Audience $read, Audience $insert, Audience $update[, string|null $updateCheck = null ]) : mixed
Parameters
- $read : Audience
-
who receives the field from
get/getBy/getAlland includes - $insert : Audience
-
who may fill it in when creating (payload without
id) - $update : Audience
-
who may change it on an existing record (payload with
idandupdateColumn(s)) - $updateCheck : string|null = null
-
presenter method name for
Audience::Ownerwhen the owner is not on this record (reserved, not evaluated yet)