当前位置: 首页>>代码示例>>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;未经允许,请勿转载。