Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate getSingleScalarResult method #6291

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADE-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ UPGRADE 3.x
UPGRADE FROM 3.x to 3.x
=======================

## Deprecated `Sonata\AdminBundle\Datagrid\ProxyQueryInterface::getSingleScalarResult`

Use `Sonata\AdminBundle\Datagrid\ProxyQueryInterface::execute` instead.

## The following templates have been deprecated

- `src/Resources/views/CRUD/base_filter_field.html.twig`
Expand Down
4 changes: 4 additions & 0 deletions src/Datagrid/ProxyQueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public function setSortOrder($sortOrder);
public function getSortOrder();

/**
* NEXT_MAJOR: Remove this method.
*
* @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0.
*
* @return mixed
*/
public function getSingleScalarResult();
Expand Down
29 changes: 19 additions & 10 deletions tests/App/Datagrid/ProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,64 @@ public function __call($name, $args)

public function execute(array $params = [], $hydrationMode = null)
{
throw new \BadMethodCallException('Not implemented.');
}

public function setSortBy($parentAssociationMappings, $fieldMapping): void
public function setSortBy($parentAssociationMappings, $fieldMapping): ProxyQueryInterface
{
throw new \BadMethodCallException('Not implemented.');
}

public function getSortBy()
public function getSortBy(): string
{
return 'e.id';
}

public function setSortOrder($sortOrder): void
public function setSortOrder($sortOrder): ProxyQueryInterface
{
throw new \BadMethodCallException('Not implemented.');
}

public function getSortOrder()
public function getSortOrder(): string
{
return 'ASC';
}

/**
* NEXT_MAJOR: Remove this method.
*/
public function getSingleScalarResult()
{
return 0;
}

public function setFirstResult($firstResult): void
public function setFirstResult($firstResult): ProxyQueryInterface
{
throw new \BadMethodCallException('Not implemented.');
}

public function getFirstResult()
public function getFirstResult(): ?int
{
throw new \BadMethodCallException('Not implemented.');
}

public function setMaxResults($maxResults): void
public function setMaxResults($maxResults): ProxyQueryInterface
{
throw new \BadMethodCallException('Not implemented.');
}

public function getMaxResults()
public function getMaxResults(): ?int
{
return 1;
}

public function getUniqueParameterId()
public function getUniqueParameterId(): int
{
return 1;
}

public function entityJoin(array $associationMappings): void
public function entityJoin(array $associationMappings): array
{
throw new \BadMethodCallException('Not implemented.');
}
}