本文整理匯總了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);
}