public function checkUniqueConstraint(string $name, array $pk, array $values) : bool {
		// create a query bulder
		$query = $this->queryBuilder(['alias' => 'a'])->select()->columns($pk);
		foreach ($this->unique[$name] as $v2) {
			if ($v2 == $this->tenant_column) {
				$values[$v2] = \Tenant::id();
				continue;
			}
			$query->whereMultiple('AND', [
				'a.' . $v2 => $values[$v2] ?? null,
			]);
		}
		$result = $query->query(null, ['cache' => false]);
		if ($result['num_rows'] > 0) {
			foreach ($result['rows'] as $v2) {
				foreach ($pk as $v3) {
					if (($v2[$v3] ?? '') != ($values[$v3] ?? '')) {
						return false;
					}
				}
			}
		}
		return true;
	}
public function checkUniqueConstraint(string $name, array $pk, array $values) : bool {
		// create a query bulder
		$query = $this->queryBuilder(['alias' => 'a'])->select()->columns($pk);
		foreach ($this->unique[$name] as $v2) {
			if ($v2 == $this->tenant_column) {
				$values[$v2] = \Tenant::id();
				continue;
			}
			$query->whereMultiple('AND', [
				'a.' . $v2 => $values[$v2] ?? null,
			]);
		}
		$result = $query->query(null, ['cache' => false]);
		if ($result['num_rows'] > 0) {
			foreach ($result['rows'] as $v2) {
				foreach ($pk as $v3) {
					if (($v2[$v3] ?? '') != ($values[$v3] ?? '')) {
						return false;
					}
				}
			}
		}
		return true;
	}
public function checkUniqueConstraint ( string $ name , array $ pk , array $ values ) : bool { // create a query bulder $ query = $ this -> queryBuilder ( [ 'alias' => 'a' ] ) -> select ( ) -> columns ( $ pk ) ; foreach ( $ this -> unique [ $ name ] as $ v2 ) { if ( $ v2 == $ this -> tenant_column ) { $ values [ $ v2 ] = \ Tenant :: id ( ) ; continue ; } $ query -> whereMultiple ( 'AND' , [ 'a.' . $ v2 => $ values [ $ v2 ] ?? null , ] ) ; } $ result = $ query -> query ( null , [ 'cache' => false ] ) ; if ( $ result [ 'num_rows' ] > 0 ) { foreach ( $ result [ 'rows' ] as $ v2 ) { foreach ( $ pk as $ v3 ) { if ( ( $ v2 [ $ v3 ] ?? '' ) != ( $ values [ $ v3 ] ?? '' ) ) { return false ; } } } } return true ; }
Check unique constraint

@param string $name
@param array $pk
@param array $values
@return bool
Check unique constraint