Skip to content

Commit

Permalink
Deprecate getSingleScalarResult
Browse files Browse the repository at this point in the history
This method is deprecated in SonataAdmin
  • Loading branch information
VincentLanglet committed Feb 28, 2021
1 parent da196a4 commit 1389ec1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/Datagrid/ProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,19 @@ public function getSortOrder()
return $this->sortOrder;
}

/**
* NEXT_MAJOR: Remove this method.
*
* @deprecated since sonata-project/doctrine-orm-admin-bundle 3.x, to be removed in 4.0.
*/
public function getSingleScalarResult()
{
@trigger_error(sprintf(
'The method "%s()" is deprecated since sonata-project/doctrine-orm-admin-bundle 3.x'
.' and will be removed in version 4.0.',
__METHOD__,
), \E_USER_DEPRECATED);

$query = $this->queryBuilder->getQuery();

return $query->getSingleScalarResult();
Expand Down
2 changes: 1 addition & 1 deletion src/Datagrid/ProxyQueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getQueryBuilder();

// /**
// * This method should be preferred over `$this->getQueryBuilder()->getQuery()`
// * since some changed are done to the query builder in order to handle all the
// * since some changes are done to the query builder in order to handle all the
// * previously called Sonata\AdminBundle\Datagrid\ProxyQueryInterface methods.
// *
// * @return Query
Expand Down
2 changes: 1 addition & 1 deletion src/Exporter/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function createIterator(BaseProxyQueryInterface $query, array $fields): S
$doctrineQuery = $query->getQuery();
}
} else {
// Distinct is need to iterate, even if group by is used
// Distinct is needed to iterate, even if group by is used
// @see https://github.com/doctrine/orm/issues/5868
$query->getQueryBuilder()->distinct();
$query->setFirstResult(null);
Expand Down

0 comments on commit 1389ec1

Please sign in to comment.