Skip to content

Commit

Permalink
bug #1863 Fix Symfony DataCollector deprecation for reset() method (J…
Browse files Browse the repository at this point in the history
…ean-Beru)

This PR was merged into the 1.16.x-dev branch.

Discussion
----------

Fix Symfony DataCollector deprecation for reset() method

This PR will remove the `Implementing "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface" without the "reset()" method is deprecated since version 3.4 and will be unsupported in 4.0 for class` warning when using EasyAdminBundle with Symfony 3.4.

Commits
-------

db65f3d Fix Symfony DataCollector deprecation for reset() method
  • Loading branch information
javiereguiluz committed Oct 18, 2017
2 parents 7be7229 + db65f3d commit 908d8f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DataCollector/EasyAdminDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ class EasyAdminDataCollector extends DataCollector
public function __construct(ConfigManager $configManager)
{
$this->configManager = $configManager;
$this->reset();
}

/**
* {@inheritdoc}
*/
public function reset()
{
$this->data = array(
'num_entities' => 0,
'request_parameters' => null,
Expand Down
11 changes: 11 additions & 0 deletions tests/DataCollector/EasyAdminDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,15 @@ public function testCollectorInformationForEditView()
$backendConfig = $collector->getBackendConfig();
$this->assertCount(5, $backendConfig['entities']);
}

public function testCollectorReset()
{
$this->client->enableProfiler();
$this->requestListView();
$collector = $this->client->getProfile()->getCollector('easyadmin');

$this->assertSame(5, $collector->getNumEntities());
$collector->reset();
$this->assertSame(0, $collector->getNumEntities());
}
}

0 comments on commit 908d8f8

Please sign in to comment.