本文整理匯總了PHP中Doctrine\ORM\Query\QueryException::syntaxError方法的典型用法代碼示例。如果您正苦於以下問題:PHP QueryException::syntaxError方法的具體用法?PHP QueryException::syntaxError怎麽用?PHP QueryException::syntaxError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\Query\QueryException
的用法示例。
在下文中一共展示了QueryException::syntaxError方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
/**
* Create platform function node.
*
* @param string $platformName
* @param string $functionName
* @param array $parameters
* @throws \Doctrine\ORM\Query\QueryException
* @return PlatformFunctionNode
*/
public static function create($platformName, $functionName, array $parameters)
{
$className = __NAMESPACE__ . '\\Platform\\Functions\\' . Inflector::classify(strtolower($platformName)) . '\\' . Inflector::classify(strtolower($functionName));
if (!class_exists($className)) {
throw QueryException::syntaxError(sprintf('Function "%s" does not supported for platform "%s"', $functionName, $platformName));
}
return new $className($parameters);
}
示例2: syntaxError
/**
* Generates a new syntax error.
*
* @param string $expected Expected string.
* @param array|null $token Got token.
*
* @return void
*
* @throws \Doctrine\ORM\Query\QueryException
*/
public function syntaxError($expected = '', $token = null)
{
if ($token === null) {
$token = $this->lexer->lookahead;
}
$tokenPos = isset($token['position']) ? $token['position'] : '-1';
$message = "line 0, col {$tokenPos}: Error: ";
$message .= $expected !== '' ? "Expected {$expected}, got " : 'Unexpected ';
$message .= $this->lexer->lookahead === null ? 'end of string.' : "'{$token['value']}'";
throw QueryException::syntaxError($message, QueryException::dqlError($this->query->getDQL()));
}
示例3: syntaxError
/**
* Generates a new syntax error.
*
* @param string $expected Expected string.
* @param array $token Got token.
*
* @throws \Doctrine\ORM\Query\QueryException
*/
public function syntaxError($expected = '', $token = null)
{
if ($token === null) {
$token = $this->_lexer->lookahead;
}
$tokenPos = isset($token['position']) ? $token['position'] : '-1';
$message = "line 0, col {$tokenPos}: Error: ";
if ($expected !== '') {
$message .= "Expected {$expected}, got ";
} else {
$message .= 'Unexpected ';
}
if ($this->_lexer->lookahead === null) {
$message .= 'end of string.';
} else {
$message .= "'{$token['value']}'";
}
throw QueryException::syntaxError($message);
}