Class IsUnique
Checks that a list of fields from an entity are unique in the table
Namespace: Cake\ORM\Rule
Property Summary
-
$_fields protected
string[]
The list of fields to check
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(string[] $fields)
Constructor.
Parameters
-
string[]
$fields The list of fields to check uniqueness for
__invoke() ¶ public
__invoke(Cake\Datasource\EntityInterface $entity, array $options): bool
Performs the uniqueness check
Parameters
-
Cake\Datasource\EntityInterface
$entity The entity from where to extract the fields where the
repository
key is required.-
array
$options Options passed to the check,
Returns
bool
_alias() ¶ protected
_alias(string $alias, array $conditions): array
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