Skip to content

Commit

Permalink
Fix deprecations introduced in admin-bundle
Browse files Browse the repository at this point in the history
Pager::setCountColumn call has been removed since that property is
not used.
  • Loading branch information
franmomu authored and OskarStark committed Jan 4, 2021
1 parent a59f450 commit eaf0a0d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"doctrine/mongodb-odm": "^2.1",
"doctrine/mongodb-odm-bundle": "^4.0",
"doctrine/persistence": "^1.3.4 || ^2.0",
"sonata-project/admin-bundle": "^3.83",
"sonata-project/admin-bundle": "^3.84",
"sonata-project/form-extensions": "^0.1 || ^1.4",
"symfony/config": "^4.4",
"symfony/dependency-injection": "^4.4",
Expand Down
1 change: 0 additions & 1 deletion src/Builder/DatagridBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public function addFilter(DatagridInterface $datagrid, $type, FieldDescriptionIn
public function getBaseDatagrid(AdminInterface $admin, array $values = [])
{
$pager = new Pager();
$pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));

$defaultOptions = [];
if ($this->csrfTokenEnabled) {
Expand Down
1 change: 1 addition & 0 deletions src/Filter/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ abstract class Filter extends BaseFilter
*/
public function apply($query, $filterData)
{
// NEXT_MAJOR: Remove next line.
$this->value = $filterData;

$field = $this->getParentAssociationMappings() ? $this->getName() : $this->getFieldName();
Expand Down
5 changes: 4 additions & 1 deletion tests/Admin/FieldDescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,13 @@ public function testSetNameSetFieldNameToo(): void
$this->assertSame($field->getFieldName(), 'New field description name');
}

/**
* NEXT_MAJOR: Remove this test.
*/
public function testSetNameDoesNotSetFieldNameWhenSetBefore(): void
{
$field = new FieldDescription('name');
$field->setFieldName('field name');
$field->setFieldName('field name', 'sonata_deprecation_mute');
$field->setName('New field description name');

$this->assertSame($field->getFieldName(), 'field name');
Expand Down
5 changes: 5 additions & 0 deletions tests/Filter/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public function testFieldDescription(): void
$this->assertSame(['class' => 'FooBar'], $filter->getFieldOptions());
}

/**
* NEXT_MAJOR: Remove this test.
*
* @group legacy
*/
public function testValues(): void
{
$filter = new FilterTest_Filter();
Expand Down

0 comments on commit eaf0a0d

Please sign in to comment.