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

Remove param from ProxyQueryInterface::execute #6827

Merged
merged 1 commit into from
Jan 31, 2021
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: 1 addition & 3 deletions src/Datagrid/ProxyQueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ interface ProxyQueryInterface
public function __call($name, $args);

/**
* @param int|null $hydrationMode
*
* @return mixed
*/
public function execute(array $params = [], $hydrationMode = null);
public function execute();

/**
* @param array $parentAssociationMappings
Expand Down
1 change: 1 addition & 0 deletions src/Datagrid/SimplePager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public function getResults($hydrationMode = null)
return $this->results;
}

// @phpstan-ignore-next-line
$this->results = $this->getQuery()->execute([], $hydrationMode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a NEXT_MAJOR version should be added to remove those arguments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is already deprecated and removed in the next major.

$this->thresholdCount = \count($this->results);
if (\count($this->results) > $this->getMaxPerPage()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/App/Datagrid/ProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __call($name, $args)
{
}

public function execute(array $params = [], $hydrationMode = null)
public function execute()
{
throw new \BadMethodCallException('Not implemented.');
}
Expand Down
5 changes: 0 additions & 5 deletions tests/Datagrid/SimplePagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function testInitNumPages(): void
$pager = new SimplePager(10, 2);
$this->proxyQuery->expects($this->once())
->method('execute')
->with([], null)
->willReturn(new ArrayCollection(range(0, 12)));

$this->proxyQuery->expects($this->once())
Expand All @@ -60,7 +59,6 @@ public function testInitOffset(): void
{
$this->proxyQuery->expects($this->once())
->method('execute')
->with([], null)
->willReturn(new ArrayCollection(range(0, 12)));

$this->proxyQuery->expects($this->once())
Expand Down Expand Up @@ -102,7 +100,6 @@ public function testNoPagesForNoResults(): void
{
$this->proxyQuery->expects($this->once())
->method('execute')
->with([], null)
->willReturn([]);

$this->proxyQuery->expects($this->once())
Expand Down Expand Up @@ -131,7 +128,6 @@ public function testGetCurrentPageResultsReturnTypeArrayCollection(): void
{
$this->proxyQuery->expects($this->once())
->method('execute')
->with([], null)
->willReturn(['foo', 'bar']);

$this->pager->setQuery($this->proxyQuery);
Expand All @@ -155,7 +151,6 @@ public function testGetCurrentPageResultsReturnTypeArray(array $queryReturnValue
{
$this->proxyQuery->expects($this->once())
->method('execute')
->with([], null)
->willReturn($queryReturnValues);

$this->pager->setQuery($this->proxyQuery);
Expand Down