CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Association
  • AssociationCollection
  • Behavior
  • BehaviorRegistry
  • EagerLoader
  • Entity
  • Marshaller
  • Query
  • ResultSet
  • RulesChecker
  • SaveOptionsBuilder
  • Table
  • TableRegistry

Interfaces

  • PropertyMarshalInterface

Traits

  • AssociationsNormalizerTrait

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
Extended by Cake\ORM\SaveOptionsBuilder uses Cake\ORM\AssociationsNormalizerTrait
Namespace: Cake\ORM
See: Cake\Datasource\RulesChecker
Location: ORM/SaveOptionsBuilder.php

Inherited Constants

  • ARRAY_AS_PROPS, STD_PROP_LIST

Properties summary

  • $_options protected
    array
    Options
  • $_table protected
    Cake\ORM\Table
    Table object.

Method Summary

  • __construct() public
    Constructor.
  • _associated() protected
    Checks that the associations exists recursively.
  • _checkAssociation() protected
    Checks if an association exists.
  • associated() public
    Set associated options.
  • atomic() public
    Sets the atomic option.
  • checkExisting() public
    Set check existing option.
  • checkRules() public
    Option to check the rules.
  • guard() public
    Set the guard option.
  • parseArrayOptions() public
    Takes an options array and populates the option object with the data.
  • set() public
    Setting custom options.
  • toArray() public
  • validate() public
    Set the validation rule set to use.

Method Detail

__construct() public ¶

__construct( Cake\ORM\Table $table , array $options = [] )

Constructor.

Parameters
Cake\ORM\Table $table
A table instance.
array $options optional []
Options to parse when instantiating.
Overrides
ArrayObject::__construct()

_associated() 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() 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
RuntimeException
If no such association exists for the given table.

associated() public ¶

associated( string|array $associated )

Set associated options.

Parameters
string|array $associated
String or array of associations.
Returns
Cake\ORM\SaveOptionsBuilder

atomic() public ¶

atomic( boolean $atomic )

Sets the atomic option.

Parameters
boolean $atomic
Atomic or not.
Returns
Cake\ORM\SaveOptionsBuilder

checkExisting() public ¶

checkExisting( boolean $checkExisting )

Set check existing option.

Parameters
boolean $checkExisting
Guard the properties or not.
Returns
Cake\ORM\SaveOptionsBuilder

checkRules() public ¶

checkRules( boolean $checkRules )

Option to check the rules.

Parameters
boolean $checkRules
Check the rules or not.
Returns
Cake\ORM\SaveOptionsBuilder

guard() public ¶

guard( boolean $guard )

Set the guard option.

Parameters
boolean $guard
Guard the properties or not.
Returns
Cake\ORM\SaveOptionsBuilder

parseArrayOptions() 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\SaveOptionsBuilder
Throws
InvalidArgumentException
If a given option key does not exist.

set() public ¶

set( string $option , mixed $value )

Setting custom options.

Parameters
string $option
Option key.
mixed $value
Option value.
Returns
Cake\ORM\SaveOptionsBuilder

toArray() public ¶

toArray( )

Returns
array

validate() 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\SaveOptionsBuilder

Methods used from Cake\ORM\AssociationsNormalizerTrait

_normalizeAssociations() 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
array
An array having dot notation transformed into nested arrays

Properties detail

$_options ¶

protected array

Options

[]

$_table ¶

protected Cake\ORM\Table

Table object.

Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs