本文整理汇总了PHP中Doctrine\ORM\Query::getEntityManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::getEntityManager方法的具体用法?PHP Query::getEntityManager怎么用?PHP Query::getEntityManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Query
的用法示例。
在下文中一共展示了Query::getEntityManager方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: close
public function close()
{
if ($this->clearEntitiesOnBatch) {
$em = $this->query->getEntityManager();
foreach ($this->clearEntitiesOnBatch as $e) {
$em->clear($e);
}
}
$this->query = null;
$this->results = null;
}
示例2: current
/**
* {@inheritdoc}
*/
public function current()
{
$current = $this->iterator->current();
$data = array();
foreach ($this->propertyPaths as $name => $propertyPath) {
try {
$data[$name] = $this->getValue($this->propertyAccessor->getValue($current[0], $propertyPath));
} catch (UnexpectedTypeException $e) {
//non existent object in path will be ignored
$data[$name] = null;
}
}
$this->query->getEntityManager()->getUnitOfWork()->detach($current[0]);
return $data;
}
示例3: __construct
/**
* Constructor.
*
* Stores various parameters that are otherwise unavailable
* because Doctrine\ORM\Query\SqlWalker keeps everything private without
* accessors.
*
* @param \Doctrine\ORM\Query $query
* @param \Doctrine\ORM\Query\ParserResult $parserResult
* @param array $queryComponents
*/
public function __construct($query, $parserResult, array $queryComponents)
{
$this->platform = $query->getEntityManager()->getConnection()->getDatabasePlatform();
$this->rsm = $parserResult->getResultSetMapping();
$this->queryComponents = $queryComponents;
parent::__construct($query, $parserResult, $queryComponents);
}
示例4: __construct
/**
* Constructor.
*
* Stores various parameters that are otherwise unavailable
* because Doctrine\ORM\Query\SqlWalker keeps everything private without
* accessors.
*
* @param \Doctrine\ORM\Query $query
* @param \Doctrine\ORM\Query\ParserResult $parserResult
* @param array $queryComponents
*/
public function __construct($query, $parserResult, array $queryComponents)
{
$this->platform = $query->getEntityManager()->getConnection()->getDatabasePlatform();
$this->rsm = $parserResult->getResultSetMapping();
$this->queryComponents = $queryComponents;
// Reset limit and offset
$this->firstResult = $query->getFirstResult();
$this->maxResults = $query->getMaxResults();
$query->setFirstResult(null)->setMaxResults(null);
parent::__construct($query, $parserResult, $queryComponents);
}
示例5: __construct
/**
* Creates a new query parser object.
*
* @param Query $query The Query to parse.
*/
public function __construct(Query $query)
{
$this->query = $query;
$this->em = $query->getEntityManager();
$this->lexer = new Lexer($query->getDql());
$this->parserResult = new ParserResult();
}
示例6: getEntityFromAlias
/**
* Resolve DQL alias into class metadata
*
* @param Doctrine\ORM\Query $query
* @param string $alias
* @return array | null
*/
protected function getEntityFromAlias($query, $alias = null)
{
$em = $query->getEntityManager();
$ast = $query->getAST();
$fromClause = $ast->fromClause;
foreach ($fromClause->identificationVariableDeclarations as $root) {
$className = $root->rangeVariableDeclaration->abstractSchemaName;
$classAlias = $root->rangeVariableDeclaration->aliasIdentificationVariable;
if ($classAlias == $alias || null === $alias) {
return array('alias' => $classAlias, 'metadata' => $em->getClassMetadata($className));
} else {
foreach ($root->joins as $join) {
$joinAlias = $join->joinAssociationDeclaration->aliasIdentificationVariable;
$joinField = $join->joinAssociationDeclaration->joinAssociationPathExpression->associationField;
$joinParent = $join->joinAssociationDeclaration->joinAssociationPathExpression->identificationVariable;
if ($joinAlias == $alias) {
if ($joinParent != $classAlias) {
$data = $this->getEntityFromAlias($query, $joinParent);
$metadata = $data['metadata'];
} else {
$metadata = $em->getClassMetadata($className);
}
$joinName = $metadata->associationMappings[$joinField]['targetEntity'];
return array('alias' => $joinAlias, 'metadata' => $em->getClassMetadata($joinName));
}
}
}
}
return null;
}
示例7: where
/**
* Add conditions to query.
*
* @access public
* @param mixed $mPredicates The restriction predicates.
* @return DB
* @since 1.0.0-alpha
* @version 1.0.0-alpha
*/
public function where($mPredicates)
{
$this->oQuery->getEntityManager()->createQueryBuilder()->where($mPredicates);
return $this;
}
示例8: __construct
/**
* Creates a new query parser object.
*
* @param Query $query The Query to parse.
*/
public function __construct(Query $query)
{
$this->_query = $query;
$this->_em = $query->getEntityManager();
$this->_lexer = new Lexer($query->getDql());
$this->_parserResult = new ParserResult();
//$this->_parserResult->setEntityManager($this->_em);
}
示例9: __construct
/**
* Constructor.
*
* @param DqlQuery $query Doctrine ORM Query object
* @param SearchConditionInterface $searchCondition SearchCondition object
*
* @throws BadMethodCallException When SearchCondition contains errors
*/
public function __construct(DqlQuery $query, SearchConditionInterface $searchCondition)
{
parent::__construct($searchCondition, $query->getEntityManager());
$this->query = $query;
}