本文整理匯總了PHP中Doctrine\ORM\Query\ResultSetMapping::addMetadataParameterMapping方法的典型用法代碼示例。如果您正苦於以下問題:PHP ResultSetMapping::addMetadataParameterMapping方法的具體用法?PHP ResultSetMapping::addMetadataParameterMapping怎麽用?PHP ResultSetMapping::addMetadataParameterMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\Query\ResultSetMapping
的用法示例。
在下文中一共展示了ResultSetMapping::addMetadataParameterMapping方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: walkInstanceOfExpression
/**
* {@inheritdoc}
*/
public function walkInstanceOfExpression($instanceOfExpr)
{
$sql = '';
$dqlAlias = $instanceOfExpr->identificationVariable;
$discrClass = $class = $this->queryComponents[$dqlAlias]['metadata'];
if ($class->discriminatorColumn) {
$discrClass = $this->em->getClassMetadata($class->rootEntityName);
}
if ($this->useSqlTableAliases) {
$sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias) . '.';
}
$sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN ');
$sqlParameterList = array();
foreach ($instanceOfExpr->value as $parameter) {
if ($parameter instanceof AST\InputParameter) {
$this->rsm->addMetadataParameterMapping($parameter->name, 'discriminatorValue');
$sqlParameterList[] = $this->walkInputParameter($parameter);
continue;
}
// Get name from ClassMetadata to resolve aliases.
$entityClassName = $this->em->getClassMetadata($parameter)->name;
$discriminatorValue = $class->discriminatorValue;
if ($entityClassName !== $class->name) {
$discrMap = array_flip($class->discriminatorMap);
if (!isset($discrMap[$entityClassName])) {
throw QueryException::instanceOfUnrelatedClass($entityClassName, $class->rootEntityName);
}
$discriminatorValue = $discrMap[$entityClassName];
}
$sqlParameterList[] = $this->conn->quote($discriminatorValue);
}
$sql .= '(' . implode(', ', $sqlParameterList) . ')';
return $sql;
}