Fr3nch13/CakePHP Utilities

ApplySettingsTrait

Be careful using this as it can easily abused since it doesn't do any complex data validation.

Table of Contents

Properties

$applyError  : string

Methods

applySettings()  : null|int
Allows changing of multiple fields in batch by their unique ids.
getApplyError()  : string
Gets an error is one happened.
setApplyError()  : void
Sets an error if one happens.

Properties

Methods

applySettings()

Allows changing of multiple fields in batch by their unique ids.

public applySettings([array<string, mixed> $data = [] ][, array<int, int> $ids = [] ][, null|Entity $entity = null ][, null|string $record_field = null ]) : null|int
Parameters
$data : array<string, mixed> = []

The data from the form with the apply key set in it.

$ids : array<int, int> = []

The unique ids that will have these changes applied.

$entity : null|Entity = null

The entity to attach to records

$record_field : null|string = null

The field on the records that the entity should be attached to.

Tags
throws
PersistenceFailedException
TODO

Use a more specific Exception when the save fails

Return values
null|int

If the save was successfull, return the record count.

getApplyError()

Gets an error is one happened.

public getApplyError() : string
Return values
string

The error message.

setApplyError()

Sets an error if one happens.

public setApplyError(string $msg) : void
Parameters
$msg : string

The error message.


        
On this page

Search results