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.
Constructor.
Checks that the associations exists recursively.
Checks if an association exists.
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
Set associated options.
Sets the atomic option.
Set check existing option.
Option to check the rules.
Set the guard option.
Takes an options array and populates the option object with the data.
Setting custom options.
Set the validation rule set to use.
__construct(Cake\ORM\Table $table, array<string, mixed> $options = [])
Constructor.
Cake\ORM\Table
$table A table instance.
array<string, mixed>
$options optional Options to parse when instantiating.
_associated(Cake\ORM\Table $table, array $associations): void
Checks that the associations exists recursively.
Cake\ORM\Table
$table Table object.
array
$associations An associations array.
void
_checkAssociation(Cake\ORM\Table $table, string $association): void
Checks if an association exists.
Cake\ORM\Table
$table Table object.
string
$association Association name.
void
RuntimeException
_normalizeAssociations(array|string $associations): array
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
associated(array|string $associated): $this
Set associated options.
array|string
$associated String or array of associations.
$this
atomic(bool $atomic): $this
Sets the atomic option.
bool
$atomic Atomic or not.
$this
checkExisting(bool $checkExisting): $this
Set check existing option.
bool
$checkExisting Guard the properties or not.
$this
checkRules(bool $checkRules): $this
Option to check the rules.
bool
$checkRules Check the rules or not.
$this
guard(bool $guard): $this
Set the guard option.
bool
$guard Guard the properties or not.
$this
parseArrayOptions(array<string, mixed> $array): $this
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<string, mixed>
$array Options array.
$this
InvalidArgumentException
set(string $option, mixed $value): $this
Setting custom options.
string
$option Option key.
mixed
$value Option value.
$this
toArray(): array<string, mixed>
array<string, mixed>
validate(string $validate): $this
Set the validation rule set to use.
string
$validate Name of the validation rule set to use.
$this
Options
array<string, mixed>
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.4/class-Cake.ORM.SaveOptionsBuilder.html