Removed request service occurrences.
This commit is contained in:
parent
71704212e4
commit
2120554141
@ -261,22 +261,6 @@ class Controller extends ContainerAware
|
||||
return $this->container->get('form.factory')->createBuilder('form', $data, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to return the request service.
|
||||
*
|
||||
* @return Request
|
||||
*
|
||||
* @deprecated Deprecated since version 2.4, to be removed in 3.0. Ask
|
||||
* Symfony to inject the Request object into your controller
|
||||
* method instead by type hinting it in the method's signature.
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
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);
|
||||
|
||||
return $this->container->get('request_stack')->getCurrentRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to return the Doctrine Registry service.
|
||||
*
|
||||
|
@ -37,22 +37,11 @@
|
||||
<argument type="collection" />
|
||||
</service>
|
||||
|
||||
<!--
|
||||
If you want to change the Request class, modify the code in
|
||||
your front controller (app.php) so that it passes an instance of
|
||||
YourRequestClass to the Kernel.
|
||||
This service definition only defines the scope of the request.
|
||||
It is used to check references scope.
|
||||
|
||||
This service is deprecated, you should use the request_stack service instead.
|
||||
-->
|
||||
<service id="request" scope="request" synthetic="true" synchronized="true" />
|
||||
|
||||
<service id="service_container" synthetic="true" />
|
||||
|
||||
<service id="kernel" synthetic="true" />
|
||||
|
||||
<service id="filesystem" class="%filesystem.class%"></service>
|
||||
<service id="filesystem" class="%filesystem.class%" />
|
||||
|
||||
<service id="file_locator" class="%file_locator.class%">
|
||||
<argument type="service" id="kernel" />
|
||||
|
@ -44,7 +44,7 @@
|
||||
</service>
|
||||
|
||||
<service id="templating.asset.path_package" class="%templating.asset.path_package.class%" abstract="true">
|
||||
<argument type="service" id="request" />
|
||||
<argument type="expression">service('request_stack').getMasterRequest()</argument>
|
||||
<argument /> <!-- version -->
|
||||
<argument /> <!-- version format -->
|
||||
</service>
|
||||
@ -55,9 +55,8 @@
|
||||
<argument /> <!-- version format -->
|
||||
</service>
|
||||
|
||||
<service id="templating.asset.request_aware_package" class="Symfony\Component\Templating\Asset\PackageInterface" abstract="true">
|
||||
<factory service="templating.asset.package_factory" method="getPackage" />
|
||||
<argument type="service" id="request" strict="false" />
|
||||
<service id="templating.asset.request_aware_package" class="Symfony\Component\Templating\Asset\PackageInterface" factory-service="templating.asset.package_factory" factory-method="getPackage" abstract="true">
|
||||
<argument type="expression">service('request_stack').getMasterRequest()</argument>
|
||||
<argument /> <!-- HTTP id -->
|
||||
<argument /> <!-- SSL id -->
|
||||
</service>
|
||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
@ -29,18 +29,15 @@ use Symfony\Component\Security\Core\Security;
|
||||
*/
|
||||
class UserLoginFormType extends AbstractType
|
||||
{
|
||||
private $request;
|
||||
private $requestStack;
|
||||
|
||||
/**
|
||||
* @param Request $request A request instance
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
public function __construct(RequestStack $requestStack)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Symfony\Component\Form\AbstractType::buildForm()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@ -50,7 +47,7 @@ class UserLoginFormType extends AbstractType
|
||||
->add('_target_path', 'hidden')
|
||||
;
|
||||
|
||||
$request = $this->request;
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
/* Note: since the Security component's form login listener intercepts
|
||||
* the POST request, this form will never really be bound to the
|
||||
@ -75,7 +72,7 @@ class UserLoginFormType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Symfony\Component\Form\AbstractType::setDefaultOptions()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
@ -89,7 +86,7 @@ class UserLoginFormType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Symfony\Component\Form\FormTypeInterface::getName()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
|
@ -4,9 +4,7 @@ imports:
|
||||
services:
|
||||
csrf_form_login.form.type:
|
||||
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
|
||||
scope: request
|
||||
arguments:
|
||||
- @request
|
||||
arguments: [ @request_stack ]
|
||||
tags:
|
||||
- { name: form.type, alias: user_login }
|
||||
|
||||
|
Reference in New Issue
Block a user