On this page
Class IsUnique
Checks that a list of fields from an entity are unique in the table
Property Summary
Method Summary
__construct() public
Constructor.
__invoke() public
Performs the uniqueness check
_alias() protected
Add a model alias to all the keys in a set of conditions.
Method Detail
__construct() public
__construct(array<string> $fields, array<string, mixed> $options = [])
Constructor.
Options
allowMultipleNullsAllows any field to have multiple null values. Defaults to false.
Parameters
array<string>$fields-
The list of fields to check uniqueness for
array<string, mixed>$options optional-
The options for unique checks.
__invoke() public
__invoke(Cake\Datasource\EntityInterface $entity, array<string, mixed> $options): bool
Performs the uniqueness check
Parameters
Cake\Datasource\EntityInterface$entity-
The entity from where to extract the fields where the
repositorykey is required. array<string, mixed>$options-
Options passed to the check,
Returns
bool_alias() protected
_alias(string $alias, array $conditions): array<string, mixed>
Add a model alias to all the keys in a set of conditions.
Parameters
string$alias-
The alias to add.
array$conditions-
The conditions to alias.
Returns
array<string, mixed>Property Detail
$_fields protected
The list of fields to check
Type
array<string>$_options protected
The unique check options
Type
array<string, mixed>© 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.IsUnique.html