本文整理汇总了PHP中Sonata\AdminBundle\Datagrid\ProxyQueryInterface::getRootAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP ProxyQueryInterface::getRootAlias方法的具体用法?PHP ProxyQueryInterface::getRootAlias怎么用?PHP ProxyQueryInterface::getRootAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Datagrid\ProxyQueryInterface
的用法示例。
在下文中一共展示了ProxyQueryInterface::getRootAlias方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: association
protected function association(ProxyQueryInterface $queryBuilder, $data)
{
$types = array(ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY, ClassMetadataInfo::MANY_TO_ONE);
if (!in_array($this->getOption('mapping_type'), $types)) {
throw new \RunTimeException('Invalid mapping type');
}
if (!$this->getOption('field_name')) {
throw new \RunTimeException('please provide a field_name options');
}
if (!$this->getOption('callback')) {
$alias = 's_' . $this->getName();
$queryBuilder->leftJoin(sprintf('%s.%s', $queryBuilder->getRootAlias(), $this->getFieldName()), $alias);
return array($alias, 'id');
} else {
return array($this->getOption('alias', $queryBuilder->getRootAlias()), false);
}
}
示例2: association
protected function association(ProxyQueryInterface $queryBuilder, $data)
{
$types = array(ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY, ClassMetadataInfo::MANY_TO_ONE);
if (!in_array($this->getOption('mapping_type'), $types)) {
throw new \RunTimeException('Invalid mapping type');
}
if (!$this->getOption('field_name')) {
throw new \RunTimeException('please provide a field_name options');
}
return array($this->getOption('alias', $queryBuilder->getRootAlias()), false);
}
示例3: batchDelete
/**
* {@inheritdoc}
*/
public function batchDelete($class, ProxyQueryInterface $queryProxy)
{
$queryProxy->select('DISTINCT ' . $queryProxy->getRootAlias());
try {
$entityManager = $this->getEntityManager($class);
$i = 0;
foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
$entityManager->remove($object[0]);
if (++$i % 20 == 0) {
$entityManager->flush();
$entityManager->clear();
}
}
$entityManager->flush();
$entityManager->clear();
} catch (\PDOException $e) {
throw new ModelManagerException('', 0, $e);
} catch (DBALException $e) {
throw new ModelManagerException('', 0, $e);
}
}
示例4: association
/**
* {@inheritdoc}
*/
protected function association(ProxyQueryInterface $queryBuilder, $data)
{
return array($this->getOption('alias', $queryBuilder->getRootAlias()), false);
}