コード例 #1
0
ファイル: DoctrineHelper.php プロジェクト: woei66/platform
 /**
  * Gets the root entity alias of the query.
  *
  * @param QueryBuilder $qb
  * @param bool         $throwException
  *
  * @return string|null
  *
  * @throws Exception\InvalidEntityException
  *
  * @deprecated since 1.9. Use QueryUtils::getSingleRootAlias instead
  */
 public function getSingleRootAlias(QueryBuilder $qb, $throwException = true)
 {
     return QueryUtils::getSingleRootAlias($qb, $throwException);
 }
コード例 #2
0
ファイル: QueryUtilsTest.php プロジェクト: antrampa/platform
 public function testGetSingleRootAliasWhenQueryHasNoRootAliasAndNoExceptionRequested()
 {
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
     $qb->expects($this->once())->method('getRootAliases')->willReturn([]);
     $this->assertNull(QueryUtils::getSingleRootAlias($qb, false));
 }