src/CRUDlex/UniqueValidator.php
protected function isValidUnique($value, AbstractData $data, Entity $entity, $field, $type)
    {
        $params          = [$field => $type === 'reference' ? $value['id'] : $value];
        $paramsOperators = [$field => '='];
        if ($entity->get('id') !== null) {
            $params['id']          = $entity->get('id');
            $paramsOperators['id'] = '!=';
        }
        $amount = intval($data->countBy($data->getDefinition()->getTable(), $params, $paramsOperators, true));
        return $amount == 0;
    }
protected function isValidUnique($value, AbstractData $data, Entity $entity, $field, $type)
    {
        $params          = [$field => $type === 'reference' ? $value['id'] : $value];
        $paramsOperators = [$field => '='];
        if ($entity->get('id') !== null) {
            $params['id']          = $entity->get('id');
            $paramsOperators['id'] = '!=';
        }
        $amount = intval($data->countBy($data->getDefinition()->getTable(), $params, $paramsOperators, true));
        return $amount == 0;
    }
protected function isValidUnique ( $ value , AbstractData $ data , Entity $ entity , $ field , $ type ) { $ params = [ $ field => $ type === 'reference' ? $ value [ 'id' ] : $ value ] ; $ paramsOperators = [ $ field => '=' ] ; if ( $ entity -> get ( 'id' ) !== null ) { $ params [ 'id' ] = $ entity -> get ( 'id' ) ; $ paramsOperators [ 'id' ] = '!=' ; } $ amount = intval ( $ data -> countBy ( $ data -> getDefinition ( ) -> getTable ( ) , $ params , $ paramsOperators , true ) ) ; return $ amount == 0 ; }
Performs the regular unique validation.

@param $value
the value to validate
@param $data
the data instance to validate with
@param $entity
the entity of the field
@param $field
the field to validate
@param $type
the type of the field to validate

@return boolean
true if everything is valid
Performs the regular unique validation .