Skip to content

Commit dfdee11

Browse files
j4nr6ndkarlovi
authored andcommitted
Revert BC breaking changes
1 parent 7a23545 commit dfdee11

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Controller/AuthorizeController.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use FOS\OAuthServerBundle\Model\ClientManagerInterface;
1818
use OAuth2\OAuth2;
1919
use OAuth2\OAuth2ServerException;
20+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
21+
use Symfony\Component\DependencyInjection\ContainerInterface;
2022
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
2123
use Symfony\Component\EventDispatcher\EventDispatcher;
2224
use Symfony\Component\Form\Form;
@@ -35,13 +37,18 @@
3537
*
3638
* @author Chris Jones <[email protected]>
3739
*/
38-
class AuthorizeController
40+
class AuthorizeController implements ContainerAwareInterface
3941
{
4042
/**
4143
* @var ClientInterface
4244
*/
4345
private $client;
4446

47+
/**
48+
* @var ContainerInterface
49+
*/
50+
protected $container;
51+
4552
/**
4653
* @var SessionInterface
4754
*/
@@ -97,6 +104,16 @@ class AuthorizeController
97104
*/
98105
private $eventDispatcher;
99106

107+
/**
108+
* Sets the container.
109+
*
110+
* @param ContainerInterface|null $container A ContainerInterface instance or null
111+
*/
112+
public function setContainer(ContainerInterface $container = null)
113+
{
114+
$this->container = $container;
115+
}
116+
100117
/**
101118
* This controller had been made as a service due to support symfony 4 where all* services are private by default.
102119
* Thus, there is considered a bad practice to fetch services directly from container.

Form/Handler/AuthorizeFormHandler.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ public function __construct(FormInterface $form, $requestStack = null)
5151
$this->requestStack = $requestStack;
5252
}
5353

54+
/**
55+
* Sets the container.
56+
*
57+
* @param ContainerInterface|null $container A ContainerInterface instance or null
58+
*/
59+
public function setContainer(ContainerInterface $container = null)
60+
{
61+
$this->container = $container;
62+
}
63+
5464
public function isAccepted()
5565
{
5666
return $this->form->getData()->accepted;
@@ -123,5 +133,7 @@ private function getCurrentRequest()
123133
return $this->requestStack->getCurrentRequest();
124134
}
125135
}
136+
137+
return $this->container->get('request');
126138
}
127139
}

0 commit comments

Comments
 (0)