OOP style Save Option Builder.
This allows you to build options to save entities in a OOP style and helps you to avoid mistakes by validating the options as you build them.
Returns an array out of the original passed associations list where dot notation is transformed into nested arrays so that they can be parsed by other routines
__construct(\Cake\ORM\Table $table, array $options)
Constructor.
\Cake\ORM\Table
$table A table instance.
array
$options optional Options to parse when instantiating.
_associated(\Cake\ORM\Table $table, array $associations)
Checks that the associations exists recursively.
\Cake\ORM\Table
$table Table object.
array
$associations An associations array.
_checkAssociation(\Cake\ORM\Table $table, string $association)
Checks if an association exists.
\Cake\ORM\Table
$table Table object.
string
$association Association name.
RuntimeException
_normalizeAssociations(mixed $associations)
Returns an array out of the original passed associations list where dot notation is transformed into nested arrays so that they can be parsed by other routines
array|string
$associations The array of included associations.
array
An array having dot notation transformed into nested arrays
associated(mixed $associated)
Set associated options.
string|array
$associated String or array of associations.
$this
atomic(bool $atomic)
Sets the atomic option.
bool
$atomic Atomic or not.
$this
checkExisting(bool $checkExisting)
Set check existing option.
bool
$checkExisting Guard the properties or not.
$this
checkRules(bool $checkRules)
Option to check the rules.
bool
$checkRules Check the rules or not.
$this
guard(bool $guard)
Set the guard option.
bool
$guard Guard the properties or not.
$this
parseArrayOptions(array $array)
Takes an options array and populates the option object with the data.
This can be used to turn an options array into the object.
array
$array Options array.
$this
InvalidArgumentException
set(string $option, mixed $value)
Setting custom options.
string
$option Option key.
mixed
$value Option value.
$this
toArray()
array
validate(string $validate)
Set the validation rule set to use.
string
$validate Name of the validation rule set to use.
$this
Options
array
Table object.
\Cake\ORM\Table
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.ORM.SaveOptionsBuilder.html