本文整理汇总了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);
}