On this page
Class IsUnique
Checks that a list of fields from an entity are unique in the table
Properties summary
Method Summary
- 
    __construct() publicConstructor.
 - 
    __invoke() publicPerforms the uniqueness check
 - 
    _alias() protectedAdd a model alias to all the keys in a set of conditions.
 
Method Detail
__construct()source public
__construct( array $fields , array $options [] )
   Constructor.
Options
allowMultipleNullsSet to false to disallow multiple null values in multi-column unique rules. By default this istrueto emulate how SQL UNIQUE keys work.
Parameters
- 
     array 
$fields - The list of fields to check uniqueness for
 - 
     array 
$optionsoptional [] - The additional options for this rule.
 
__invoke()source public
__invoke( Cake\Datasource\EntityInterface $entity , array $options )
   Performs the uniqueness check
Parameters
Cake\Datasource\EntityInterface$entity- 
     
The entity from where to extract the fields where the
repositorykey is required. - 
     array 
$options - Options passed to the check,
 
Returns
boolean_alias()source protected
_alias( string $alias , array $conditions , boolean $multipleNulls )
   Add a model alias to all the keys in a set of conditions.
Null values will be omitted from the generated conditions, as SQL UNIQUE indexes treat NULL != NULL
Parameters
- 
     string 
$alias - The alias to add.
 - 
     array 
$conditions - The conditions to alias.
 - 
     boolean 
$multipleNulls - Whether or not to allow multiple nulls.
 
Returns
arrayProperties detail
© 2005–2017 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/3.3/class-Cake.ORM.Rule.IsUnique.html