Search the model for a particular relationship.
This method expects to be passed the ID, but
the parameter name should be the relationship name.

@param $parameter
@param $value

@return bool
505159
public function whereHas($parameter, $value)
    {
        if (! $this->verify($parameter, $value)) {
            return true;
        }

        $this->search = $this->search
            ->whereHas($parameter, function ($query) use ($value) {
                $query->where('rbac_roles.id', $value);
            });
    }
1276005
protected function query($value)
    {
        /** @var EntityManagerInterface $objectManager */
        $objectManager = $this->getOption('object_manager');
        /** @var string $targetClass */
        $targetClass = $this->getOption('target_class');

        /** @var \PServerCore\Entity\Repository\User $repo */
        $repo = $objectManager->getRepository($targetClass);

        return $repo->isUserValid4UserName($value);
    }
600101
protected function isRequiredWithAll($value, $parameters)
    {
        if (!$this->anyFailingRequired($parameters)) {
            return $this->isRequired($value);
        }

        return true;
    }
654810
public static function find_one_by($property, $value)
    {
        global $wpdb;

        // Escape the value
        $value = esc_sql($value);

        // Get the table name
        $table = static::get_table();

        // Get the item
        $obj = $wpdb->get_row("SELECT * FROM `{$table}` WHERE `{$property}` = '{$value}'", ARRAY_A);

        // Return false if no item was found, or a new model
        return ($obj ? static::create($obj) : false);
    }
1137368
protected function query($value)
    {
        $result = false;

        switch ($this->getKey()) {
            case 'email':
                $result = $this->getMapper()->findByEmail($value);
                break;

            case 'username':
                $result = $this->getMapper()->findByUsername($value);
                break;

            default:
                throw new \Exception('Invalid key used in ZfcUser validator');
                break;
        }

        return $result;
    }
238500
public function search($criteria, $value = null)
    {
        foreach ($this->members as $obj) {
            if (is_string($criteria)) {
                if ($obj->getProperty($criteria) == $value) {
                    return $obj;
                }
            } elseif ($criteria instanceof Closure) {
                if ($criteria($obj)) {
                    return $obj;
                }
            } else {
                throw new Exception\InvalidArgumentException(sprintf(
                    "Argument 1 must be either string or Closure, %s passed",
                    gettype($criteria)
                ));
            }
        }
        return false;
    }
783170
public function isSize($value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'size');

        return $this->getSize($value) == $parameters[0];
    }
1247237
protected function isRequiredWithoutAll($value, $parameters)
    {
        if ($this->allFailingRequired($parameters)) {
            return $this->isRequired($value);
        }

        return true;
    }
935000
private function setPayloadParameter(string $parameter, $value): void
    {
        $this->checkParameterType($value);

        $this->defaultSetPayloadParameter($parameter, $value);
    }
109845
public function contains( $key, $value = null )
	{
		if ( func_num_args() == 2 )
		{
			return parent::contains( $key, $value );
		}

		if ( $this->useAsCallable( $key ) )
		{
			return parent::contains( $key );
		}

		$key = $key instanceof Model ? $key->getKey() : $key;

		return parent::contains( function ( $k, $m ) use ( $key )
		{
			return $m->getKey() == $key;
		} );
	}
597572
private function lookupValue($value)
    {
        foreach ($this->pairs as $pair) {
            if ($pair->value === $value) {
                return $pair;
            }
        }
    }
340418
public function isScenarioParameter($value, $checkExp = false) {
        if ($this->scenarioParameters === null) {
            $this->initParameters();
        }
        $result = isset($this->scenarioParameters[$value]);
        if (!$result) {
            if (substr($value, 0, 1) === "%" && substr($value, strlen($value) - 1, 1) === "%") {
                $result = true;
            }
        }
        if (!$result && $checkExp === true) {
            foreach ($this->scenarioParameters as $key => $v) {
                if (preg_match("/" . $key . "/", $value)) {
                    $result = true;
                    break;
                }
            }
        }
        return $result;
    }
559586
public function normalizeValue(Parameter $parameter, string $value = null)
    {
        if (\is_bool($default = $parameter->default())) {
            return !$default;
        }

        if ($parameter->variadic()) {
            return (array) $value;
        }

        if (null === $value) {
            return $parameter->required() ? null : true;
        }

        return $parameter->filter($value);
    }
1004631
public function bindValue($parameter = null, $value = null, $type = null)
    {
        parent::bindValue($parameter, $value, $type);
        
        return $this;
    }
1036365
protected function _validate_range($value, $parameter)
    {
        if (preg_match('#^(-?[\.\d]+)-(-?[\d\.]+)$#', $parameter, $match)) {
            return $value >= $match[1] && $value <= $match[2] ? $value : null;
        } else {
            throw new InvalidValueException(['range validator `:parameter` parameters is not {min}-{max} format', 'parameter' => $parameter]);
        }
    }
1133110
public function isMatcher($value): bool
    {
        if (is_object($value)) {
            if ($value instanceof Matcher) {
                return true;
            }

            foreach ($this->driverIndex as $className => $driver) {
                if (is_a($value, $className)) {
                    return true;
                }
            }
        }

        return false;
    }
1262932
public function has($value)
    {
        $id = is_object($value) ? spl_object_hash($value) : $value;
        return isset($this->_data[$id]);
    }