Fr3nch13/CakePHP Utilities

InvalidPropertyInterface

Describes the methods that any class representing a data storage should comply with.

Table of Contents

Methods

getInvalid()  : array<string|int, mixed>
Get a list of invalid fields and their data for errors upon validation/patching
getInvalidField()  : mixed|null
Get a single value of an invalid field. Returns null if not set.
setInvalid()  : $this
Set fields as invalid and not patchable into the entity.
setInvalidField()  : $this
Sets a field as invalid and not patchable into the entity.

Methods

getInvalid()

Get a list of invalid fields and their data for errors upon validation/patching

public getInvalid() : array<string|int, mixed>
Return values
array<string|int, mixed>

getInvalidField()

Get a single value of an invalid field. Returns null if not set.

public getInvalidField(string $field) : mixed|null
Parameters
$field : string

The name of the field.

Return values
mixed|null

setInvalid()

Set fields as invalid and not patchable into the entity.

public setInvalid(array<string, mixed> $fields[, bool $overwrite = false ]) : $this

This is useful for batch operations when one needs to get the original value for an error message after patching. This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes or to be able to log it away.

Parameters
$fields : array<string, mixed>

The values to set.

$overwrite : bool = false

Whether to overwrite pre-existing values for $field.

Return values
$this

setInvalidField()

Sets a field as invalid and not patchable into the entity.

public setInvalidField(string $field, mixed $value) : $this
Parameters
$field : string

The value to set.

$value : mixed

The invalid value to be set for $field.

Return values
$this

        
On this page

Search results