Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Drop support for Symfony < 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk authored and jordisala1991 committed Jun 23, 2020
1 parent f197399 commit 0ec504f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 43 deletions.
59 changes: 30 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,29 @@
],
"require": {
"php": "^7.2",
"sonata-project/classification-bundle": "^3.6",
"sonata-project/datagrid-bundle": "^2.3",
"sonata-project/classification-bundle": "^3.12",
"sonata-project/datagrid-bundle": "^2.3.1",
"sonata-project/doctrine-extensions": "^1.5.1",
"sonata-project/easy-extends-bundle": "^2.5",
"sonata-project/form-extensions": "^0.1 || ^1.4",
"sonata-project/formatter-bundle": "^3.4 || ^4.0",
"sonata-project/formatter-bundle": "^4.0",
"sonata-project/intl-bundle": "^2.4",
"sonata-project/media-bundle": "^3.10",
"sonata-project/media-bundle": "^3.20",
"sonata-project/twig-extensions": "^0.1 || ^1.3",
"swiftmailer/swiftmailer": "^4.3 || ^5.0 || ^6.0",
"symfony/config": "^3.4 || ^4.2",
"symfony/console": "^3.4 || ^4.2",
"symfony/dependency-injection": "^3.4 || ^4.2",
"symfony/event-dispatcher": "^3.4 || ^4.0",
"symfony/form": "^3.4 || ^4.2",
"symfony/framework-bundle": "^3.4 || ^4.2",
"symfony/http-foundation": "^3.4.35 || ^4.2.12",
"symfony/http-kernel": "^3.4 || ^4.2",
"symfony/options-resolver": "^3.4 || ^4.2",
"symfony/routing": "^3.4 || ^4.2",
"symfony/security-core": "^3.4 || ^4.2",
"symfony/templating": "^3.4 || ^4.2",
"symfony/config": "^4.3",
"symfony/console": "^4.3",
"symfony/dependency-injection": "^4.3",
"symfony/event-dispatcher": "^4.3",
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0",
"symfony/form": "^4.3",
"symfony/framework-bundle": "^4.3",
"symfony/http-foundation": "^4.3",
"symfony/http-kernel": "^4.3",
"symfony/options-resolver": "^4.3",
"symfony/routing": "^4.3",
"symfony/security-core": "^4.3",
"symfony/templating": "^4.3",
"twig/string-extra": "^3.0",
"twig/twig": "^2.12.1"
},
Expand All @@ -56,29 +57,29 @@
"sonata-project/admin-bundle": "<3.59",
"sonata-project/block-bundle": "<3.18",
"sonata-project/core-bundle": "<3.20",
"sonata-project/doctrine-orm-admin-bundle": "<3.0 || >=4.0",
"sonata-project/notification-bundle": "<3.0 || >=4.0",
"sonata-project/seo-bundle": "<2.0 || >=3.0"
"sonata-project/doctrine-orm-admin-bundle": "<3.5 || >=4.0",
"sonata-project/notification-bundle": "<3.4 || >=4.0",
"sonata-project/seo-bundle": "<2.5 || >=3.0"
},
"require-dev": {
"doctrine/orm": "^2.4",
"friendsofsymfony/rest-bundle": "^1.8 || ^2.1",
"jms/serializer-bundle": "^2.0 || ^3.0",
"friendsofsymfony/rest-bundle": "^2.3",
"jms/serializer-bundle": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"nelmio/api-doc-bundle": "^2.4",
"nelmio/api-doc-bundle": "^2.13.3",
"sonata-project/admin-bundle": "^3.59",
"sonata-project/block-bundle": "^3.18",
"sonata-project/doctrine-orm-admin-bundle": "^3.4",
"sonata-project/notification-bundle": "^3.3",
"sonata-project/doctrine-orm-admin-bundle": "^3.5",
"sonata-project/notification-bundle": "^3.4",
"sonata-project/seo-bundle": "^2.5",
"symfony/phpunit-bridge": "^5.0"
"symfony/phpunit-bridge": "^5.1"
},
"suggest": {
"nelmio/api-doc-bundle": "If you want to use the API",
"nelmio/api-doc-bundle": "If you want to use the API.",
"sonata-project/block-bundle": "For rendering block lists.",
"sonata-project/doctrine-orm-admin-bundle": "^2.2",
"sonata-project/notification-bundle": "^2.2",
"twig/extra-bundle": "Auto configures the Twig Intl extension"
"sonata-project/doctrine-orm-admin-bundle": "For integrate Doctrine ORM into the SonataAdminBundle.",
"sonata-project/notification-bundle": "If you want to send comment notification asynchronously.",
"twig/extra-bundle": "Auto configures the Twig Intl extension."
},
"config": {
"sort-packages": true
Expand Down
10 changes: 5 additions & 5 deletions src/Action/CreateCommentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
use Sonata\NewsBundle\Model\PostManagerInterface;
use Sonata\NewsBundle\SonataNewsEvents;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

final class CreateCommentAction extends Controller
{
Expand Down Expand Up @@ -126,7 +126,7 @@ public function __invoke(Request $request, $id)
// NEXT_MAJOR: Remove the if code
if (null !== $this->eventDispatcher) {
$event = new GetResponseCommentEvent($comment, $request);
$this->eventDispatcher->dispatch(SonataNewsEvents::COMMENT_INITIALIZE, $event);
$this->eventDispatcher->dispatch($event, SonataNewsEvents::COMMENT_INITIALIZE);

if (null !== $event->getResponse()) {
return $event->getResponse();
Expand All @@ -140,7 +140,7 @@ public function __invoke(Request $request, $id)
// NEXT_MAJOR: Remove the if code
if (null !== $this->eventDispatcher) {
$event = new FormEvent($form, $request);
$this->eventDispatcher->dispatch(SonataNewsEvents::COMMENT_SUCCESS, $event);
$this->eventDispatcher->dispatch($event, SonataNewsEvents::COMMENT_SUCCESS);
}

$comment = $form->getData();
Expand All @@ -156,8 +156,8 @@ public function __invoke(Request $request, $id)
// NEXT_MAJOR: Remove the if code
if (null !== $this->eventDispatcher) {
$this->eventDispatcher->dispatch(
SonataNewsEvents::COMMENT_COMPLETED,
new FilterCommentResponseEvent($comment, $request, $response)
new FilterCommentResponseEvent($comment, $request, $response),
SonataNewsEvents::COMMENT_COMPLETED
);
}

Expand Down
8 changes: 1 addition & 7 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('sonata_news');

// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('sonata_news');
} else {
$rootNode = $treeBuilder->getRootNode();
}
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
2 changes: 1 addition & 1 deletion src/Event/CommentEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace Sonata\NewsBundle\Event;

use Sonata\NewsBundle\Model\CommentInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\Event;

class CommentEvent extends Event
{
Expand Down
2 changes: 1 addition & 1 deletion src/Event/FormEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace Sonata\NewsBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\Event;

final class FormEvent extends Event
{
Expand Down

0 comments on commit 0ec504f

Please sign in to comment.