CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.2 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.2
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 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

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
      • Exception
    • Error
    • Event
    • Filesystem
    • Form
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class RuleInvoker

Contains logic for invoking an application rule.

Combined with Cake\Datasource\RuleChecker as an implementation detail to de-duplicate rule decoration and provide cleaner separation of duties.

Namespace: Cake\Datasource

Property Summary

  • $name protected
    string

    The rule name

  • $options protected
    array

    Rule options

  • $rule protected
    callable

    Rule callable

Method Summary

  • __construct() public

    Constructor

  • __invoke() public

    Invoke the rule.

  • setName() public

    Set the rule name.

  • setOptions() public

    Set options for the rule invocation.

Method Detail

__construct() ¶ public

__construct(callable $rule, string $name, array $options = [])

Constructor

Options

  • errorField The field errors should be set onto.
  • message The error message.

Individual rules may have additional options that can be set here. Any options will be passed into the rule as part of the rule $scope.

Parameters
callable $rule

The rule to be invoked.

string $name

The name of the rule. Used in error messsages.

array $options optional

The options for the rule. See above.

__invoke() ¶ public

__invoke(Cake\Datasouce\EntityInterface $entity, array $scope): bool

Invoke the rule.

Parameters
Cake\Datasouce\EntityInterface $entity

The entity the rule should apply to.

array $scope

The rule's scope/options.

Returns
bool

setName() ¶ public

setName(string $name): $this

Set the rule name.

Only truthy names will be set.

Parameters
string $name

The name to set.

Returns
$this

setOptions() ¶ public

setOptions(array $options): $this

Set options for the rule invocation.

Old options will be merged with the new ones.

Parameters
array $options

The options to set.

Returns
$this

Property Detail

$name ¶ protected

The rule name

Type
string

$options ¶ protected

Rule options

Type
array

$rule ¶ protected

Rule callable

Type
callable
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs