當前位置: 首頁>>代碼示例>>PHP>>正文


PHP QueryException::associationPathInverseSideNotSupported方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Query\QueryException::associationPathInverseSideNotSupported方法的典型用法代碼示例。如果您正苦於以下問題:PHP QueryException::associationPathInverseSideNotSupported方法的具體用法?PHP QueryException::associationPathInverseSideNotSupported怎麽用?PHP QueryException::associationPathInverseSideNotSupported使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Query\QueryException的用法示例。


在下文中一共展示了QueryException::associationPathInverseSideNotSupported方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: walkPathExpression

 /**
  * {@inheritdoc}
  */
 public function walkPathExpression($pathExpr)
 {
     $sql = '';
     switch ($pathExpr->type) {
         case AST\PathExpression::TYPE_STATE_FIELD:
             $fieldName = $pathExpr->field;
             $dqlAlias = $pathExpr->identificationVariable;
             $class = $this->queryComponents[$dqlAlias]['metadata'];
             if ($this->useSqlTableAliases) {
                 $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName) . '.';
             }
             $sql .= $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform);
             break;
         case AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION:
             // 1- the owning side:
             //    Just use the foreign key, i.e. u.group_id
             $fieldName = $pathExpr->field;
             $dqlAlias = $pathExpr->identificationVariable;
             $class = $this->queryComponents[$dqlAlias]['metadata'];
             if (isset($class->associationMappings[$fieldName]['inherited'])) {
                 $class = $this->em->getClassMetadata($class->associationMappings[$fieldName]['inherited']);
             }
             $assoc = $class->associationMappings[$fieldName];
             if (!$assoc['isOwningSide']) {
                 throw QueryException::associationPathInverseSideNotSupported();
             }
             // COMPOSITE KEYS NOT (YET?) SUPPORTED
             if (count($assoc['sourceToTargetKeyColumns']) > 1) {
                 throw QueryException::associationPathCompositeKeyNotSupported();
             }
             if ($this->useSqlTableAliases) {
                 $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.';
             }
             $sql .= reset($assoc['targetToSourceKeyColumns']);
             break;
         default:
             throw QueryException::invalidPathExpression($pathExpr);
     }
     return $sql;
 }
開發者ID:nemekzg,項目名稱:doctrine2,代碼行數:43,代碼來源:SqlWalker.php

示例2: walkPathExpression

 /**
  * Walks down a PathExpression AST node, thereby generating the appropriate SQL.
  *
  * @param mixed
  * @return string The SQL.
  */
 public function walkPathExpression($pathExpr)
 {
     $sql = '';
     switch ($pathExpr->type) {
         case AST\PathExpression::TYPE_STATE_FIELD:
             $parts = $pathExpr->parts;
             $fieldName = array_pop($parts);
             $dqlAlias = $pathExpr->identificationVariable . (!empty($parts) ? '.' . implode('.', $parts) : '');
             $class = $this->_queryComponents[$dqlAlias]['metadata'];
             if ($this->_useSqlTableAliases) {
                 $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName) . '.';
             }
             $sql .= $class->getQuotedColumnName($fieldName, $this->_platform);
             break;
         case AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION:
             // 1- the owning side:
             //    Just use the foreign key, i.e. u.group_id
             $parts = $pathExpr->parts;
             $fieldName = array_pop($parts);
             $dqlAlias = $pathExpr->identificationVariable;
             $class = $this->_queryComponents[$dqlAlias]['metadata'];
             $assoc = $class->associationMappings[$fieldName];
             if ($assoc->isOwningSide) {
                 // COMPOSITE KEYS NOT (YET?) SUPPORTED
                 if (count($assoc->sourceToTargetKeyColumns) > 1) {
                     throw QueryException::associationPathCompositeKeyNotSupported();
                 }
                 $sql .= $this->walkIdentificationVariable($dqlAlias) . '.' . reset($assoc->targetToSourceKeyColumns);
             } else {
                 // 2- Inverse side: NOT (YET?) SUPPORTED
                 throw QueryException::associationPathInverseSideNotSupported();
             }
             break;
         default:
             throw QueryException::invalidPathExpression($pathExpr);
     }
     return $sql;
 }
開發者ID:andreia,項目名稱:doctrine,代碼行數:44,代碼來源:SqlWalker.php


注:本文中的Doctrine\ORM\Query\QueryException::associationPathInverseSideNotSupported方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。