diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ca3670ba..43d1bbbbab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,36 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [3.82.0](https://github.com/sonata-project/SonataAdminBundle/compare/3.81.1...3.82.0) - 2020-12-05 +### Added +- [[#6643](https://github.com/sonata-project/SonataAdminBundle/pull/6643)] Added generics to `CRUDController` ([@VincentLanglet](https://github.com/VincentLanglet)) +- [[#6631](https://github.com/sonata-project/SonataAdminBundle/pull/6631)] Option to globally override the data source of all the admin ([@VincentLanglet](https://github.com/VincentLanglet)) +- [[#6547](https://github.com/sonata-project/SonataAdminBundle/pull/6547)] Added `row_attr` to the form_row container. ([@nieuwenhuisen](https://github.com/nieuwenhuisen)) +- [[#6609](https://github.com/sonata-project/SonataAdminBundle/pull/6609)] `AdminSearchCompilerPass` in order to configure which admins must support search. ([@phansys](https://github.com/phansys)) +- [[#6609](https://github.com/sonata-project/SonataAdminBundle/pull/6609)] Support for `global_search` attribute in `sonata.admin` tags, which admits boolean values. ([@phansys](https://github.com/phansys)) + +### Changed +- [[#6559](https://github.com/sonata-project/SonataAdminBundle/pull/6559)] Removed alias from `ModelManagerInterface::createQuery` method ([@neok](https://github.com/neok)) +- [[#6214](https://github.com/sonata-project/SonataAdminBundle/pull/6214)] `CRUDController::handleXmlHttpRequestSuccessResponse` method is now protected ([@nieuwenhuisen](https://github.com/nieuwenhuisen)) +- [[#6214](https://github.com/sonata-project/SonataAdminBundle/pull/6214)] `CRUDController::handleXmlHttpRequestErrorResponse` method is now protected ([@nieuwenhuisen](https://github.com/nieuwenhuisen)) +- [[#6630](https://github.com/sonata-project/SonataAdminBundle/pull/6630)] Replaced jQuery "load()" with "on()" in Admin.js ([@timwentzell](https://github.com/timwentzell)) +- [[#6632](https://github.com/sonata-project/SonataAdminBundle/pull/6632)] Twig templates: "list_percent", "show_percent", "list_currency" and "show_currency" ([@willemverspyck](https://github.com/willemverspyck)) + +### Deprecated +- [[#6618](https://github.com/sonata-project/SonataAdminBundle/pull/6618)] `AdminInterface::validate` method specification ([@tambait](https://github.com/tambait)) +- [[#6618](https://github.com/sonata-project/SonataAdminBundle/pull/6618)] `AbstractAdmin:validate` method implementation ([@tambait](https://github.com/tambait)) +- [[#6618](https://github.com/sonata-project/SonataAdminBundle/pull/6618)] `AbstractAdmin::attachInlineValidator()` method ([@tambait](https://github.com/tambait)) +- [[#6618](https://github.com/sonata-project/SonataAdminBundle/pull/6618)] `AdminExtensionInterface::validate()` method specification ([@tambait](https://github.com/tambait)) +- [[#6618](https://github.com/sonata-project/SonataAdminBundle/pull/6618)] `AbstractAdminExtension::validate()` method implementation ([@tambait](https://github.com/tambait)) +- [[#6622](https://github.com/sonata-project/SonataAdminBundle/pull/6622)] Referencing to DashboardAction and SearchAction by FQCN class instead of id. ([@VincentLanglet](https://github.com/VincentLanglet)) +- [[#6634](https://github.com/sonata-project/SonataAdminBundle/pull/6634)] Deprecated `Pool::getPropertyAccessor()` method. ([@franmomu](https://github.com/franmomu)) +- [[#6634](https://github.com/sonata-project/SonataAdminBundle/pull/6634)] Deprecated not passing and instance of `PropertyAccessor` as argument 1 to `Sonata\AdminBundle\Admin\AdminHelper` constructor. ([@franmomu](https://github.com/franmomu)) +- [[#6634](https://github.com/sonata-project/SonataAdminBundle/pull/6634)] Deprecated not passing and instance of `PropertyAccessor` as argument 5 to `Sonata\AdminBundle\Action\SetObjectFieldValueAction` constructor. ([@franmomu](https://github.com/franmomu)) +- [[#6634](https://github.com/sonata-project/SonataAdminBundle/pull/6634)] Deprecated not passing and instance of `PropertyAccessor` as argument 5 to `Sonata\AdminBundle\Twig\Extension\SonataAdminExtension` constructor. ([@franmomu](https://github.com/franmomu)) + +### Fixed +- [[#6529](https://github.com/sonata-project/SonataAdminBundle/pull/6529)] Explicitly cast types in `CRUDController::batchAction()` ([@peter-gribanov](https://github.com/peter-gribanov)) + ## [3.81.1](https://github.com/sonata-project/SonataAdminBundle/compare/3.81.0...3.81.1) - 2020-11-21 ### Fixed - [[#6597](https://github.com/sonata-project/SonataAdminBundle/pull/6597)] `AdminInterface` extends `MutableTemplateRegistryAwareInterface` instead of `TemplateRegistryAwareInterface` ([@VincentLanglet](https://github.com/VincentLanglet)) diff --git a/UPGRADE-3.x.md b/UPGRADE-3.x.md index de606c3760..3b9479190d 100644 --- a/UPGRADE-3.x.md +++ b/UPGRADE-3.x.md @@ -8,6 +8,9 @@ UPGRADE FROM 3.xx to 3.xx Methods are deprecated without replacement. +UPGRADE FROM 3.81 to 3.82 +========================= + ### Sonata\AdminBundle\Model\ModelManagerInterface Argument 2 of `Sonata\AdminBundle\Model\ModelManagerInterface::createQuery()` method has been removed. diff --git a/src/Action/SetObjectFieldValueAction.php b/src/Action/SetObjectFieldValueAction.php index 9e6626da58..8be007355a 100644 --- a/src/Action/SetObjectFieldValueAction.php +++ b/src/Action/SetObjectFieldValueAction.php @@ -92,7 +92,7 @@ public function __construct( if (null === $propertyAccessor) { @trigger_error(sprintf( 'Omitting the argument 5 for "%s()" or passing "null" is deprecated since sonata-project/admin-bundle' - .' 3.x and will throw a \TypeError error in version 4.0. You must pass an instance of %s instead.', + .' 3.82 and will throw a \TypeError error in version 4.0. You must pass an instance of %s instead.', __METHOD__, PropertyAccessorInterface::class ), E_USER_DEPRECATED); diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index f6c1f14beb..c9fc74c5aa 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -734,7 +734,7 @@ public function validate(ErrorElement $errorElement, $object) { if ('sonata_deprecation_mute' !== (\func_get_args()[2] ?? null)) { @trigger_error(sprintf( - 'The %s method is deprecated since version 3.x and will be removed in 4.0.', + 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } @@ -827,7 +827,7 @@ public function delete($object) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x, will be removed in 4.0. + * @deprecated since sonata-project/admin-bundle 3.82, will be removed in 4.0. * * @param object $object * @@ -837,7 +837,7 @@ public function preValidate($object) { if ('sonata_deprecation_mute' !== \func_get_args()[1] ?? null) { @trigger_error(sprintf( - 'The %s method is deprecated since version 3.x and will be removed in 4.0.', + 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } @@ -3615,13 +3615,13 @@ protected function getSubClass($name) * * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x. + * @deprecated since sonata-project/admin-bundle 3.82. */ protected function attachInlineValidator() { if ('sonata_deprecation_mute' !== \func_get_args()[0] ?? null) { @trigger_error(sprintf( - 'The %s method is deprecated since version 3.x and will be removed in 4.0.', + 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } diff --git a/src/Admin/AbstractAdminExtension.php b/src/Admin/AbstractAdminExtension.php index 2c78395a83..1ae2a1ef65 100644 --- a/src/Admin/AbstractAdminExtension.php +++ b/src/Admin/AbstractAdminExtension.php @@ -65,7 +65,7 @@ public function validate(AdminInterface $admin, ErrorElement $errorElement, $obj { if ('sonata_deprecation_mute' !== (\func_get_args()[3] ?? null)) { @trigger_error(sprintf( - 'The %s method is deprecated since version 3.x and will be removed in 4.0.', + 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } diff --git a/src/Admin/AdminExtensionInterface.php b/src/Admin/AdminExtensionInterface.php index 95b6ed56df..6b53097109 100644 --- a/src/Admin/AdminExtensionInterface.php +++ b/src/Admin/AdminExtensionInterface.php @@ -106,7 +106,7 @@ public function configureTabMenu( * * @return void * - * @deprecated since sonata-project/admin-bundle 3.x. + * @deprecated since sonata-project/admin-bundle 3.82. * * @phpstan-param AdminInterface $admin */ diff --git a/src/Admin/AdminHelper.php b/src/Admin/AdminHelper.php index 1b17a7a06b..01fceffe33 100644 --- a/src/Admin/AdminHelper.php +++ b/src/Admin/AdminHelper.php @@ -71,7 +71,7 @@ public function __construct($poolOrPropertyAccessor) if ($poolOrPropertyAccessor instanceof Pool) { @trigger_error(sprintf( 'Passing an instance of "%s" as argument 1 for "%s()" is deprecated since' - .' sonata-project/admin-bundle 3.x and will throw a \TypeError error in version 4.0.' + .' sonata-project/admin-bundle 3.82 and will throw a \TypeError error in version 4.0.' .' You MUST pass an instance of %s instead.', Pool::class, __METHOD__, diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 69d0098a7d..dfc210504a 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -554,7 +554,7 @@ public function hasSubject(); * * @return void * - * @deprecated since sonata-project/admin-bundle 3.x. + * @deprecated since sonata-project/admin-bundle 3.82. * * @phpstan-param T $object */ diff --git a/src/Admin/Pool.php b/src/Admin/Pool.php index 494338bb1f..b5a74e75e0 100644 --- a/src/Admin/Pool.php +++ b/src/Admin/Pool.php @@ -79,7 +79,7 @@ class Pool * * @var PropertyAccessorInterface * - * @deprecated since sonata-project/admin-bundle 3.x, will be dropped in 4.0. + * @deprecated since sonata-project/admin-bundle 3.82, will be dropped in 4.0. */ protected $propertyAccessor; @@ -112,7 +112,7 @@ public function __construct( // NEXT_MAJOR: Remove this block. if (null !== $propertyAccessor) { @trigger_error(sprintf( - 'Passing an "%s" instance as argument 4 to "%s()" is deprecated since sonata-project/admin-bundle 3.x.', + 'Passing an "%s" instance as argument 4 to "%s()" is deprecated since sonata-project/admin-bundle 3.82.', PropertyAccessorInterface::class, __METHOD__ ), E_USER_DEPRECATED); @@ -563,12 +563,12 @@ public function getOption($name, $default = null) } /** - * @deprecated since sonata-project/admin-bundle 3.x, will be dropped in 4.0. Use Symfony "PropertyAccess" instead. + * @deprecated since sonata-project/admin-bundle 3.82, will be dropped in 4.0. Use Symfony "PropertyAccess" instead. */ public function getPropertyAccessor() { @trigger_error(sprintf( - 'The "%s" method is deprecated since version 3.x and will be removed in 4.0.', + 'The "%s" method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); diff --git a/src/Controller/CRUDController.php b/src/Controller/CRUDController.php index 0c9f44f4bf..8867821875 100644 --- a/src/Controller/CRUDController.php +++ b/src/Controller/CRUDController.php @@ -1574,7 +1574,7 @@ protected function handleXmlHttpRequestErrorResponse(Request $request, FormInter { if (empty(array_intersect(['application/json', '*/*'], $request->getAcceptableContentTypes()))) { @trigger_error(sprintf( - 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.x.' + 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.82.' .' It will result in a response with the status code 406 (Not Acceptable) in 4.0. You must add "application/json".', implode('", "', $request->getAcceptableContentTypes()), $request->getMethod(), @@ -1602,7 +1602,7 @@ protected function handleXmlHttpRequestSuccessResponse(Request $request, object { if (empty(array_intersect(['application/json', '*/*'], $request->getAcceptableContentTypes()))) { @trigger_error(sprintf( - 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.x.' + 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.82.' .' It will result in a response with the status code 406 (Not Acceptable) in 4.0. You must add "application/json".', implode('", "', $request->getAcceptableContentTypes()), $request->getMethod(), diff --git a/src/Resources/config/actions.php b/src/Resources/config/actions.php index ce411a56d1..1d34612d36 100644 --- a/src/Resources/config/actions.php +++ b/src/Resources/config/actions.php @@ -39,8 +39,8 @@ // NEXT_MAJOR: Remove the alias. ->alias(DashboardAction::class, 'sonata.admin.action.dashboard') ->deprecate(...BCDeprecationParameters::forConfig( - 'The "%alias_id%" alias is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', - '3.x' + 'The "%alias_id%" alias is deprecated since sonata-project/admin-bundle 3.82 and will be removed in 4.0.', + '3.82' )) ->set('sonata.admin.action.search', SearchAction::class) @@ -55,8 +55,8 @@ // NEXT_MAJOR: Remove the alias. ->alias(SearchAction::class, 'sonata.admin.action.search') ->deprecate(...BCDeprecationParameters::forConfig( - 'The "%alias_id%" alias is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', - '3.x' + 'The "%alias_id%" alias is deprecated since sonata-project/admin-bundle 3.82 and will be removed in 4.0.', + '3.82' )) ->set('sonata.admin.action.append_form_field_element', AppendFormFieldElementAction::class) diff --git a/src/Twig/Extension/SonataAdminExtension.php b/src/Twig/Extension/SonataAdminExtension.php index a255269c91..665e847be1 100644 --- a/src/Twig/Extension/SonataAdminExtension.php +++ b/src/Twig/Extension/SonataAdminExtension.php @@ -141,7 +141,7 @@ public function __construct( if ($propertyAccessorOrSecurityChecker instanceof AuthorizationCheckerInterface) { @trigger_error(sprintf( 'Passing an instance of "%s" as argument 5 for "%s()" is deprecated since sonata-project/admin-bundle' - .' 3.x and will throw a \TypeError error in version 4.0. You MUST pass an instance of "%s" instead and pass' + .' 3.82 and will throw a \TypeError error in version 4.0. You MUST pass an instance of "%s" instead and pass' .' an instance of "%s" as argument 6.', AuthorizationCheckerInterface::class, __METHOD__, @@ -154,7 +154,7 @@ public function __construct( } elseif (null === $propertyAccessorOrSecurityChecker) { @trigger_error(sprintf( 'Omitting the argument 5 for "%s()" or passing "null" is deprecated since sonata-project/admin-bundle' - .' 3.x and will throw a \TypeError error in version 4.0. You must pass an instance of "%s" instead.', + .' 3.82 and will throw a \TypeError error in version 4.0. You must pass an instance of "%s" instead.', __METHOD__, PropertyAccessorInterface::class ), E_USER_DEPRECATED); diff --git a/tests/Admin/AdminHelperTest.php b/tests/Admin/AdminHelperTest.php index 62b0d0e777..e28c6716af 100644 --- a/tests/Admin/AdminHelperTest.php +++ b/tests/Admin/AdminHelperTest.php @@ -65,7 +65,7 @@ public function testDeprecatedConstructingWithoutPropertyAccessor(): void $this->expectDeprecation(sprintf( 'Passing an instance of "%s" as argument 1 for "%s::__construct()" is deprecated since' - .' sonata-project/admin-bundle 3.x and will throw a \TypeError error in version 4.0. You MUST pass an instance' + .' sonata-project/admin-bundle 3.82 and will throw a \TypeError error in version 4.0. You MUST pass an instance' .' of %s instead.', Pool::class, AdminHelper::class, diff --git a/tests/Controller/CRUDControllerTest.php b/tests/Controller/CRUDControllerTest.php index a816fba3ef..d7717bd429 100644 --- a/tests/Controller/CRUDControllerTest.php +++ b/tests/Controller/CRUDControllerTest.php @@ -1746,7 +1746,7 @@ public function testEditActionAjaxErrorWithoutAcceptApplicationJson(): void ->willReturn('flash message'); $this->expectDeprecation(sprintf( - 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.x.' + 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.82.' .' It will result in a response with the status code 406 (Not Acceptable) in 4.0. You must add "application/json".', implode('", "', $this->request->getAcceptableContentTypes()), $this->request->getMethod(), @@ -2454,7 +2454,7 @@ public function testCreateActionAjaxErrorWithoutAcceptApplicationJson(): void ->willReturn('flash message'); $this->expectDeprecation(sprintf( - 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.x.' + 'None of the passed values ("%s") in the "Accept" header when requesting %s %s is supported since sonata-project/admin-bundle 3.82.' .' It will result in a response with the status code 406 (Not Acceptable) in 4.0. You must add "application/json".', implode('", "', $this->request->getAcceptableContentTypes()), $this->request->getMethod(), diff --git a/tests/Twig/Extension/SonataAdminExtensionTest.php b/tests/Twig/Extension/SonataAdminExtensionTest.php index 9c2e624a30..1156f48f86 100644 --- a/tests/Twig/Extension/SonataAdminExtensionTest.php +++ b/tests/Twig/Extension/SonataAdminExtensionTest.php @@ -293,7 +293,7 @@ public function testConstructTriggersDeprecationWithAuthorizationCheckerArgument { $this->expectDeprecation(sprintf( 'Passing an instance of "%s" as argument 5 for "%s::__construct()" is deprecated since' - .' sonata-project/admin-bundle 3.x and will throw a \TypeError error in version 4.0. You MUST pass an instance' + .' sonata-project/admin-bundle 3.82 and will throw a \TypeError error in version 4.0. You MUST pass an instance' .' of "%s" instead and pass an instance of "%s" as argument 6.', AuthorizationCheckerInterface::class, SonataAdminExtension::class,