diff --git a/UPGRADE-3.x.md b/UPGRADE-3.x.md index cc26d0c688d..c3a969a2cc8 100644 --- a/UPGRADE-3.x.md +++ b/UPGRADE-3.x.md @@ -1,6 +1,12 @@ UPGRADE 3.x =========== +### Deprecated `Sonata\AdminBundle\Model\DatagridManagerInterface` interface. + +This interface has been deprecated without replacement. + +`ModelManager::getDefaultSortValues()` won't be use anymore. + ### Deprecated not configuring `acl_user_manager` and using ACL security handler when `friendsofsymfony/user-bundle` is installed. If you are using `friendsofsymfony/user-bundle` and using ACL security handler, you MUST explicitly configure the `acl_user_manager`. diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 914a5e89065..6eecbc117fb 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -830,10 +830,10 @@ public function preBatchAction($actionName, ProxyQueryInterface $query, array &$ public function getFilterParameters() { $parameters = array_merge( - $this->getModelManager()->getDefaultSortValues($this->getClass()), + $this->getModelManager()->getDefaultSortValues($this->getClass()), // NEXT_MAJOR: Remove this line. $this->datagridValues, // NEXT_MAJOR: Remove this line. $this->getDefaultSortValues(), - $this->getDefaultFilterValues() + $this->getDefaultFilterValues(), ); // build the values array @@ -1699,7 +1699,7 @@ public function getMaxPerPage() { // NEXT_MAJOR: Remove this line and uncomment the following. return $this->maxPerPage; - // $sortValues = $this->getModelManager()->getDefaultSortValues($this->class); + // $sortValues = $this->getDefaultSortValues(); // return $sortValues['_per_page'] ?? 25; } @@ -2918,7 +2918,7 @@ public function getPerPageOptions() { // NEXT_MAJOR: Remove this line and uncomment the following return $this->perPageOptions; -// $perPageOptions = $this->getModelManager()->getDefaultPerPageOptions($this->class); +// $perPageOptions = [10, 25, 50, 100, 250]; // $perPageOptions[] = $this->getMaxPerPage(); // // $perPageOptions = array_unique($perPageOptions); @@ -3312,7 +3312,9 @@ protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterfa */ final protected function getDefaultSortValues(): array { + // NEXT_MAJOR: Use the next line instead. $defaultSortValues = []; + // $defaultSortValues = ['_page' => 1, '_per_page' => 25]; $this->configureDefaultSortValues($defaultSortValues); diff --git a/src/Model/DatagridManagerInterface.php b/src/Model/DatagridManagerInterface.php index fae7a9ff887..df9655b94ec 100644 --- a/src/Model/DatagridManagerInterface.php +++ b/src/Model/DatagridManagerInterface.php @@ -16,6 +16,8 @@ /** * A datagrid manager is a bridge between the model classes and the admin datagrid functionality. * + * NEXT_MAJOR: Remove this interface + * * @method array getDefaultPerPageOptions(string $class) */ interface DatagridManagerInterface @@ -28,12 +30,4 @@ interface DatagridManagerInterface * @return array */ public function getDefaultSortValues($class); - -// NEXT_MAJOR: Uncomment the following lines. -// /** -// * Return all the allowed _per_page values. -// * -// * @return array -// */ -// public function getDefaultPerPageOptions(string $class): array; }