Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb120c3c

Browse files
author
Hugo Hamon
committed
Removed request service occurrences.
1 parent7170421 commitb120c3c

File tree

5 files changed

+13
-46
lines changed

5 files changed

+13
-46
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -261,22 +261,6 @@ public function createFormBuilder($data = null, array $options = array())
261261
return$this->container->get('form.factory')->createBuilder('form',$data,$options);
262262
}
263263

264-
/**
265-
* Shortcut to return the request service.
266-
*
267-
* @return Request
268-
*
269-
* @deprecated Deprecated since version 2.4, to be removed in 3.0. Ask
270-
* Symfony to inject the Request object into your controller
271-
* method instead by type hinting it in the method's signature.
272-
*/
273-
publicfunctiongetRequest()
274-
{
275-
trigger_error('The "getRequest" method of the base "Controller" class has been deprecated since Symfony 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.',E_USER_DEPRECATED);
276-
277-
return$this->container->get('request_stack')->getCurrentRequest();
278-
}
279-
280264
/**
281265
* Shortcut to return the Doctrine Registry service.
282266
*

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,11 @@
3737
<argumenttype="collection" />
3838
</service>
3939

40-
<!--
41-
If you want to change the Request class, modify the code in
42-
your front controller (app.php) so that it passes an instance of
43-
YourRequestClass to the Kernel.
44-
This service definition only defines the scope of the request.
45-
It is used to check references scope.
46-
47-
This service is deprecated, you should use the request_stack service instead.
48-
-->
49-
<serviceid="request"scope="request"synthetic="true"synchronized="true" />
50-
5140
<serviceid="service_container"synthetic="true" />
5241

5342
<serviceid="kernel"synthetic="true" />
5443

55-
<serviceid="filesystem"class="%filesystem.class%"></service>
44+
<serviceid="filesystem"class="%filesystem.class%"/>
5645

5746
<serviceid="file_locator"class="%file_locator.class%">
5847
<argumenttype="service"id="kernel" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</service>
4545

4646
<serviceid="templating.asset.path_package"class="%templating.asset.path_package.class%"abstract="true">
47-
<argumenttype="service"id="request" />
47+
<argumenttype="expression">service('request_stack').getCurrentRequest()</argument>
4848
<argument /><!-- version-->
4949
<argument /><!-- version format-->
5050
</service>
@@ -55,9 +55,8 @@
5555
<argument /><!-- version format-->
5656
</service>
5757

58-
<serviceid="templating.asset.request_aware_package"class="Symfony\Component\Templating\Asset\PackageInterface"abstract="true">
59-
<factoryservice="templating.asset.package_factory"method="getPackage" />
60-
<argumenttype="service"id="request"strict="false" />
58+
<serviceid="templating.asset.request_aware_package"class="Symfony\Component\Templating\Asset\PackageInterface"factory-service="templating.asset.package_factory"factory-method="getPackage"abstract="true">
59+
<argumenttype="expression">service('request_stack').getCurrentRequest()</argument>
6160
<argument /><!-- HTTP id-->
6261
<argument /><!-- SSL id-->
6362
</service>

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
useSymfony\Component\Form\FormError;
1717
useSymfony\Component\Form\FormEvents;
1818
useSymfony\Component\Form\FormEvent;
19-
useSymfony\Component\HttpFoundation\Request;
19+
useSymfony\Component\HttpFoundation\RequestStack;
2020
useSymfony\Component\OptionsResolver\OptionsResolverInterface;
2121
useSymfony\Component\Security\Core\Security;
2222

@@ -29,18 +29,15 @@
2929
*/
3030
class UserLoginFormTypeextends AbstractType
3131
{
32-
private$request;
32+
private$requestStack;
3333

34-
/**
35-
* @param Request $request A request instance
36-
*/
37-
publicfunction__construct(Request$request)
34+
publicfunction__construct(RequestStack$requestStack)
3835
{
39-
$this->request =$request;
36+
$this->requestStack =$requestStack;
4037
}
4138

4239
/**
43-
*@see Symfony\Component\Form\AbstractType::buildForm()
40+
*{@inheritdoc}
4441
*/
4542
publicfunctionbuildForm(FormBuilderInterface$builder,array$options)
4643
{
@@ -50,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5047
->add('_target_path','hidden')
5148
;
5249

53-
$request =$this->request;
50+
$request =$this->requestStack->getCurrentRequest();
5451

5552
/* Note: since the Security component's form login listener intercepts
5653
* the POST request, this form will never really be bound to the
@@ -75,7 +72,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7572
}
7673

7774
/**
78-
*@see Symfony\Component\Form\AbstractType::setDefaultOptions()
75+
*{@inheritdoc}
7976
*/
8077
publicfunctionsetDefaultOptions(OptionsResolverInterface$resolver)
8178
{
@@ -89,7 +86,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
8986
}
9087

9188
/**
92-
*@see Symfony\Component\Form\FormTypeInterface::getName()
89+
*{@inheritdoc}
9390
*/
9491
publicfunctiongetName()
9592
{

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ imports:
44
services:
55
csrf_form_login.form.type:
66
class:Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
7-
scope:request
8-
arguments:
9-
- @request
7+
arguments:[ @request_stack ]
108
tags:
119
-{ name: form.type, alias: user_login }
1210

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp