Skip to content

Commit

Permalink
Support Symfony 5 (#31)
Browse files Browse the repository at this point in the history
* Support Symfony 5

* Support Symfony 5- update layout ref

* add symfony 4.4 supports as well

Co-authored-by: Oliver THEBAULT <Oliboy50@users.noreply.github.com>

Co-authored-by: Oliver THEBAULT <Oliboy50@users.noreply.github.com>
  • Loading branch information
joanna-bak-sourceability and Oliboy50 committed Jul 9, 2021
1 parent a659f4e commit 7ccebae
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ php:
- 7.1

env:
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.*
- SYMFONY_VERSION=4.4.*
- SYMFONY_VERSION=5.0.*
- SYMFONY_VERSION=5.3.*

branches:
only:
Expand Down
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
],
"require": {
"php": ">=7.0",
"ext-json": "*",
"elasticsearch/elasticsearch": "^5.1.0||^6.0.0"
},
"require-dev": {
"atoum/atoum": "^2.8||^3.0",
"m6web/coke": "~1.2.0",
"m6web/symfony2-coding-standard": "~1.2.0",
"symfony/dependency-injection": "^2.3||^3.0",
"symfony/event-dispatcher": "^2.3||^3.0",
"symfony/config": "^2.3||^3.0",
"symfony/yaml": "^2.3||^3.0"
"symfony/dependency-injection": "^4.4||^5.0",
"symfony/event-dispatcher": "^4.4||^5.0",
"symfony/config": "^4.4||^5.0",
"symfony/yaml": "^4.4||^5.0",
"symfony/http-foundation": "^4.4||^5.0",
"symfony/http-kernel": "^4.4||^5.0"
},
"autoload": {
"psr-0": { "": "src/" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handleEvent(ElasticsearchEvent $event)
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('m6web_elasticsearch');
$treeBuilder = new TreeBuilder('m6web_elasticsearch');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,8 @@ protected function createHandler(ContainerBuilder $container, array $config, $de
*/
private function setFactoryToDefinition($className, $method, Definition $definition)
{
// Symfony 2.3 backward compatibility
if (method_exists('Symfony\Component\DependencyInjection\Definition', 'setFactory')) {
$definition->setFactory([$className, $method]);
} else {
$definition
->setFactoryClass($className)
->setFactoryMethod($method);
}
$definition
->setFactory([$className, $method]);
}

/**
Expand All @@ -168,7 +162,7 @@ protected function createDataCollector(ContainerBuilder $container)
$collectorDefinition->addTag(
'data_collector',
[
'template' => 'M6WebElasticsearchBundle:Collector:elasticsearch',
'template' => '@M6WebElasticsearch/Collector/elasticsearch.html.twig',
'id' => 'elasticsearch'
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace M6Web\Bundle\ElasticsearchBundle\EventDispatcher;


use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;

/**
* Class ElasticsearchEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __invoke(array $request)
$event->setError($response['error']->getMessage());
}

$this->eventDispatcher->dispatch('m6web.elasticsearch', $event);
$this->eventDispatcher->dispatch($event, 'm6web.elasticsearch');

return $response;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
{% set icon %}
Expand All @@ -18,7 +18,7 @@
<span>{{ '%0.2f'|format(collector.totalExecutionTime * 1000) }} ms</span>
</div>
{% endset %}
{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'link': profiler_url} %}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with {'link': profiler_url} %}
{% endblock %}

{% block menu %}
Expand Down

0 comments on commit 7ccebae

Please sign in to comment.