Skip to content

Commit

Permalink
Merge branch '3.x' into validator-add-deprecation-notices
Browse files Browse the repository at this point in the history
  • Loading branch information
tambait authored Dec 5, 2020
2 parents 283d83c + 666bf76 commit 89ea0e1
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 26 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions UPGRADE-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
*
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AbstractAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AdminExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<object> $admin
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AdminHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Admin/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/Extension/SonataAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Admin/AdminHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/Controller/CRUDControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Twig/Extension/SonataAdminExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 89ea0e1

Please sign in to comment.