Skip to content

Commit 584cfc2

Browse files
committed
feature #16069 [WebProfilerBundle] Move AjaxCollector to HttpKernel for use with Silex (glaubinix, fabpot)
This PR was merged into the 2.8 branch. Discussion ---------- [WebProfilerBundle] Move AjaxCollector to HttpKernel for use with Silex | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR moves the AjaxDataCollector from the FrameworkBundle to the HttpKernel Component where most of the other DataCollectors are. This would allow applications which are not base on symfony/framework-bundle to use the collector. Like for instance applications based on silex or symfony components. Commits ------- 3841f46 added missing a deprecated notice c227806 Move AjaxCollector for use without framework bundle
2 parents 6413fb7 + 3841f46 commit 584cfc2

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

src/Symfony/Bundle/FrameworkBundle/DataCollector/AjaxDataCollector.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DataCollector;
1313

14-
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpFoundation\Response;
16-
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
14+
use Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector as BaseAjaxDataCollector;
15+
16+
@trigger_error('The '.__NAMESPACE__.'\AjaxDataCollector class is deprecated since version 2.8 and will be removed in 3.0. Use Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector instead.', E_USER_DEPRECATED);
1717

1818
/**
1919
* AjaxDataCollector.
2020
*
2121
* @author Bart van den Burg <bart@burgov.nl>
22+
*
23+
* @deprecated since version 2.8, to be removed in 3.0.
2224
*/
23-
class AjaxDataCollector extends DataCollector
25+
class AjaxDataCollector extends BaseAjaxDataCollector
2426
{
25-
public function collect(Request $request, Response $response, \Exception $exception = null)
26-
{
27-
// all collecting is done client side
28-
}
29-
30-
public function getName()
31-
{
32-
return 'ajax';
33-
}
3427
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="335" />
2727
</service>
2828

29-
<service id="data_collector.ajax" class="Symfony\Bundle\FrameworkBundle\DataCollector\AjaxDataCollector" public="false">
29+
<service id="data_collector.ajax" class="Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector" public="false">
3030
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="315" />
3131
</service>
3232

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\HttpKernel\DataCollector;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\HttpFoundation\Response;
16+
17+
/**
18+
* AjaxDataCollector.
19+
*
20+
* @author Bart van den Burg <bart@burgov.nl>
21+
*/
22+
class AjaxDataCollector extends DataCollector
23+
{
24+
public function collect(Request $request, Response $response, \Exception $exception = null)
25+
{
26+
// all collecting is done client side
27+
}
28+
29+
public function getName()
30+
{
31+
return 'ajax';
32+
}
33+
}

0 commit comments

Comments
 (0)