Class SaveOptionsBuilder
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.
- ArrayObject implements IteratorAggregate, Traversable, ArrayAccess, Serializable, Countable
-  Cake\ORM\SaveOptionsBuilder uses Cake\ORM\AssociationsNormalizerTrait 
Inherited Constants
-  ARRAY_AS_PROPS,STD_PROP_LIST
Properties summary
Method Summary
-  __construct() publicConstructor.
-  _associated() protectedChecks that the associations exists recursively.
-  _checkAssociation() protectedChecks if an association exists.
-  associated() publicSet associated options.
-  atomic() publicSets the atomic option.
-  checkExisting() publicSet check existing option.
-  checkRules() publicOption to check the rules.
-  guard() publicSet the guard option.
-  parseArrayOptions() publicTakes an options array and populates the option object with the data.
-  set() publicSetting custom options.
-  toArray() public
-  validate() publicSet the validation rule set to use.
Method Detail
__construct()source public
__construct( Cake\ORM\Table $table , array $options [] )
Constructor.
Parameters
-  Cake\ORM\Table$table
- A table instance.
-  array $optionsoptional []
- Options to parse when instantiating.
Overrides
ArrayObject::__construct()  _associated()source protected
_associated( Cake\ORM\Table $table , array $associations )
Checks that the associations exists recursively.
Parameters
-  Cake\ORM\Table$table
- Table object.
-  array $associations
- An associations array.
_checkAssociation()source protected
_checkAssociation( Cake\ORM\Table $table , string $association )
Checks if an association exists.
Parameters
-  Cake\ORM\Table$table
- Table object.
-  string $association
- Association name.
Throws
RuntimeExceptionIf no such association exists for the given table.
associated()source public
associated( string|array $associated )
Set associated options.
Parameters
-  string|array $associated
- String or array of associations.
Returns
Cake\ORM\SaveOptionsBuilderatomic()source public
atomic( boolean $atomic )
Sets the atomic option.
Parameters
-  boolean $atomic
- Atomic or not.
Returns
Cake\ORM\SaveOptionsBuildercheckExisting()source public
checkExisting( boolean $checkExisting )
Set check existing option.
Parameters
-  boolean $checkExisting
- Guard the properties or not.
Returns
Cake\ORM\SaveOptionsBuildercheckRules()source public
checkRules( boolean $checkRules )
Option to check the rules.
Parameters
-  boolean $checkRules
- Check the rules or not.
Returns
Cake\ORM\SaveOptionsBuilderguard()source public
guard( boolean $guard )
Set the guard option.
Parameters
-  boolean $guard
- Guard the properties or not.
Returns
Cake\ORM\SaveOptionsBuilderparseArrayOptions()source public
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.
Parameters
-  array $array
- Options array.
Returns
Cake\ORM\SaveOptionsBuilderThrows
InvalidArgumentExceptionIf a given option key does not exist.
set()source public
set( string $option , mixed $value )
Setting custom options.
Parameters
-  string $option
- Option key.
-  mixed $value
- Option value.
Returns
Cake\ORM\SaveOptionsBuildervalidate()source public
validate( string $validate )
Set the validation rule set to use.
Parameters
-  string $validate
- Name of the validation rule set to use.
Returns
Cake\ORM\SaveOptionsBuilderMethods used from Cake\ORM\AssociationsNormalizerTrait
_normalizeAssociations()source protected
_normalizeAssociations( array $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
Parameters
-  array $associations
- The array of included associations.
Returns
arrayAn array having dot notation transformed into nested arrays
Properties detail
    © 2005–2017 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/3.4/class-Cake.ORM.SaveOptionsBuilder.html