Checks that the value provided in a field exists as the primary key of another table.
array<string>
The list of fields to check
array<string, mixed>
Options for the constructor
Cake\ORM\TableCake\ORM\Association|string
The repository where the field will be looked for
Constructor.
Performs the existence check
Checks whether the given entity fields are nullable and null.
__construct(array<string>|string $fields, Cake\ORM\TableCake\ORM\Association|string $repository, array<string, mixed> $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.
array<string>|string
$fields The field or fields to check existence as primary key.
Cake\ORM\TableCake\ORM\Association|string
$repository The repository where the field will be looked for, or the association name for the repository.
array<string, mixed>
$options optional The options that modify the rule's 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(Cake\Datasource\EntityInterface $entity, array<string, mixed> $options): bool
Performs the existence check
Cake\Datasource\EntityInterface
$entity The entity from where to extract the fields
array<string, mixed>
$options Options passed to the check, where the repository
key is required.
bool
RuntimeException
_fieldsAreNull(Cake\Datasource\EntityInterface $entity, Cake\ORM\Table $source): bool
Checks whether the given entity fields are nullable and null.
Cake\Datasource\EntityInterface
$entity The entity to check.
Cake\ORM\Table
$source The table to use schema from.
bool
The list of fields to check
array<string>
Options for the constructor
array<string, mixed>
The repository where the field will be looked for
Cake\ORM\TableCake\ORM\Association|string
© 2005–present 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/4.4/class-Cake.ORM.Rule.ExistsIn.html