Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some deprecations #1296

Merged
merged 3 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SonataPageBundle Configuration
# config/packages/sonata_page.yaml

sonata_page:
slugify_service: sonata.core.slugify.cocur # old BC value is sonata.core.slugify.native
slugify_service: sonata.page.slugify.cocur # old BC value is sonata.core.slugify.native
multisite: host
use_streamed_response: true # set the value to false in debug mode or if the reverse proxy does not handle streamed response
ignore_route_patterns:
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/PageAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\Cache\CacheManagerInterface;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\PageBundle\Exception\InternalErrorException;
use Sonata\PageBundle\Exception\PageNotFoundException;
use Sonata\PageBundle\Form\Type\PageSelectorType;
Expand Down Expand Up @@ -253,7 +254,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
->add('pageAlias')
->add('parent')
->add('edited')
->add('hybrid', 'doctrine_orm_callback', [
->add('hybrid', CallbackFilter::class, [
'callback' => static function ($queryBuilder, $alias, $field, $data) {
if (\in_array($data['value'], ['hybrid', 'cms'], true)) {
$queryBuilder->andWhere(sprintf('%s.routeName %s :routeName', $alias, 'cms' === $data['value'] ? '=' : '!='));
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('slugify_service')
// NEXT_MAJOR: reword this info message
->info('You should use: sonata.core.slugify.cocur, but for BC we keep \'sonata.core.slugify.native\' as default')
->info('You should use: sonata.page.slugify.cocur, but for BC we keep \'sonata.core.slugify.native\' as default')

// NEXT_MAJOR: use "sonata.core.slugify.cocur" instead of "sonata.core.slugify.native" as default value
// NEXT_MAJOR: use "sonata.page.slugify.cocur" instead of "sonata.core.slugify.native" as default value
->defaultValue('sonata.core.slugify.native')
->end()
->arrayNode('ignore_routes')
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/views/PageAdmin/field_hybrid.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ file that was distributed with this source code.
{% extends '@SonataAdmin/CRUD/base_list_field.html.twig' %}

{% block field %}
{% spaceless %}
{% apply spaceless %}
{% if object.isHybrid %}
<i class="fa fa-gears"></i>
{% else %}
<i class="fa fa-code"></i>
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock %}
2 changes: 1 addition & 1 deletion src/Resources/views/PageAdmin/tree.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ file that was distributed with this source code.
{% import _self as tree %}
{% macro pages(pages, admin, rootPages) %}
<ul{% if rootPages %} class="page-tree"{% endif %}>
{% for page in pages if not page.internal and (not page.parent or not rootPages)%}
{% for page in pages|filter(page => not page.internal and (not page.parent or not rootPages)) %}
<li>
<div class="page-tree__item">
{% if page.parent %}<i class="fa fa-caret-right"></i>{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions src/SonataPageBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public function boot()
} else {
@trigger_error(
'The "sonata.core.slugify.native" service is deprecated since 2.3.9, to be removed in 4.0. '.
'Use "sonata.core.slugify.cocur" service through config instead.',
'Use "sonata.page.slugify.cocur" service through config instead.',
\E_USER_DEPRECATED
);

// default BC value, you should use sonata.core.slugify.cocur
$id = 'sonata.core.slugify.native';
// default BC value, you should use sonata.page.slugify.cocur
$id = 'sonata.page.slugify.cocur';
}

$service = $container->get($id);
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/Extension/PageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class PageExtension extends AbstractExtension implements InitRuntimeInterface
private $resources;

/**
* @var \Twig_Environment
* @var Environment
*/
private $environment;

Expand Down
2 changes: 1 addition & 1 deletion tests/App/config/sonata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sonata_block:
default_contexts: [sonata_page_bundle]

sonata_page:
slugify_service: sonata.core.slugify.cocur
slugify_service: sonata.page.slugify.cocur
multisite: host
use_streamed_response: false

Expand Down