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

  • ExistsIn
  • IsUnique
  • ValidCount

Class ExistsIn

Checks that the value provided in a field exists as the primary key of another table.

Namespace: Cake\ORM\Rule
Location: ORM/Rule/ExistsIn.php

Properties summary

  • $_fields protected
    array
    The list of fields to check
  • $_options protected
    array
    Options for the constructor
  • $_repository protected
    Cake\Datasource\RepositoryInterface|Cake\ORM\Association|string
    The repository where the field will be looked for

Method Summary

  • __construct() public
    Constructor.
  • __invoke() public
    Performs the existence check
  • _fieldsAreNull() protected
    Checks whether or not the given entity fields are nullable and null.

Method Detail

__construct() public ¶

__construct( string|array $fields , Cake\Datasource\RepositoryInterface|Cake\ORM\Association|string $repository , array $options = [] )

Constructor.

Available option for $options is 'allowNullableNulls' flag. Set to true to accept composite foreign keys where one or more nullable columns are null.

Parameters
string|array $fields
The field or fields to check existence as primary key.
Cake\Datasource\RepositoryInterface|Cake\ORM\Association|string $repository

The repository where the field will be looked for, or the association name for the repository.

array $options optional []

The options that modify the rules behavior. Options 'allowNullableNulls' will make the rule pass if given foreign keys are set to null. Notice: allowNullableNulls cannot pass by database columns set to NOT NULL.

__invoke() public ¶

__invoke( Cake\Datasource\EntityInterface $entity , array $options )

Performs the existence check

Parameters
Cake\Datasource\EntityInterface $entity
The entity from where to extract the fields
array $options

Options passed to the check, where the repository key is required.

Returns
boolean
Throws
RuntimeException
When the rule refers to an undefined association.

_fieldsAreNull() protected ¶

_fieldsAreNull( Cake\Datasource\EntityInterface $entity , Cake\ORM\Table $source )

Checks whether or not the given entity fields are nullable and null.

Parameters
Cake\Datasource\EntityInterface $entity
The entity to check.
Cake\ORM\Table $source
The table to use schema from.
Returns
boolean

Properties detail

$_fields ¶

protected array

The list of fields to check

$_options ¶

protected array

Options for the constructor

[]

$_repository ¶

protected Cake\Datasource\RepositoryInterface|Cake\ORM\Association|string

The repository where the field will be looked for

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