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.1 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.1
      • 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

Trait RulesAwareTrait

A trait that allows a class to build and apply application. rules.

If the implementing class also implements EventAwareTrait, then events will be emitted when rules are checked.

The implementing class is expected to define the RULES_CLASS constant if they need to customize which class is used for rules objects.

Namespace: Cake\Datasource

Property Summary

  • $_rulesChecker protected
    Cake\Datasource\RulesChecker

    The domain rules to be applied to entities saved by this table

Method Summary

  • buildRules() public

    Returns a RulesChecker object after modifying the one that was supplied.

  • checkRules() public

    Returns whether or not the passed entity complies with all the rules stored in the rules checker.

  • rulesChecker() public

    Returns the RulesChecker for this instance.

Method Detail

buildRules() ¶ public

buildRules(Cake\Datasource\RulesChecker $rules): Cake\Datasource\RulesChecker

Returns a RulesChecker object after modifying the one that was supplied.

Subclasses should override this method in order to initialize the rules to be applied to entities saved by this instance.

Parameters
Cake\Datasource\RulesChecker $rules

The rules object to be modified.

Returns
Cake\Datasource\RulesChecker

checkRules() ¶ public

checkRules(Cake\Datasource\EntityInterface $entity, string $operation = RulesChecker::CREATE, ArrayObject|array $options = null): bool

Returns whether or not the passed entity complies with all the rules stored in the rules checker.

Parameters
Cake\Datasource\EntityInterface $entity

The entity to check for validity.

string $operation optional

The operation being run. Either 'create', 'update' or 'delete'.

ArrayObject|array $options optional

The options To be passed to the rules.

Returns
bool

rulesChecker() ¶ public

rulesChecker(): Cake\Datasource\RulesChecker

Returns the RulesChecker for this instance.

A RulesChecker object is used to test an entity for validity on rules that may involve complex logic or data that needs to be fetched from relevant datasources.

Returns
Cake\Datasource\RulesChecker
See Also
\Cake\Datasource\RulesChecker

Property Detail

$_rulesChecker ¶ protected

The domain rules to be applied to entities saved by this table

Type
Cake\Datasource\RulesChecker
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