本文整理汇总了PHP中Doctrine\ORM\EntityManager::getExpressionBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::getExpressionBuilder方法的具体用法?PHP EntityManager::getExpressionBuilder怎么用?PHP EntityManager::getExpressionBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\EntityManager
的用法示例。
在下文中一共展示了EntityManager::getExpressionBuilder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIdExpression
/**
* get DQL expression for id value
*
* @param integer|string $id
* @param EntityManager $em
* @return string
*/
private function getIdExpression($id, EntityManager $em)
{
if (is_string($id)) {
$id = $em->getExpressionBuilder()->literal($id);
}
if ($id === null) {
$id = 'NULL';
}
return (string) $id;
}
示例2: expr
/**
* Gets an ExpressionBuilder used for object-oriented construction of query expressions.
* Intended for convenient inline usage. Example:
*
* [php]
* $qb = $em->createQueryBuilder()
* ->select('u')
* ->from('User', 'u')
* ->where($qb->expr()->eq('u.id', 1));
*
* @return Expr
*/
public function expr()
{
return $this->_em->getExpressionBuilder();
}
示例3: getExpressionBuilder
/**
* {@inheritDoc}
*
* @static
*/
public static function getExpressionBuilder()
{
return \Doctrine\ORM\EntityManager::getExpressionBuilder();
}
示例4: testEmptyNumericLiteral
/**
* @group DDC-1211
*/
public function testEmptyNumericLiteral()
{
$expr = $this->_em->getExpressionBuilder();
$qb = $this->_em->createQueryBuilder()->select('u')->from('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u')->where($expr->eq('u.username', $expr->literal(0)));
$this->assertEquals('SELECT u FROM Doctrine\\Tests\\Models\\CMS\\CmsUser u WHERE u.username = 0', $qb->getDQL());
}
示例5: getExpressionBuilder
/**
* {@inheritdoc}
*/
public function getExpressionBuilder()
{
return $this->wrapped->getExpressionBuilder();
}