4
4
5
5
use Oro \Bundle \IntegrationBundle \Entity \Channel ;
6
6
use Oro \Bundle \IntegrationBundle \Form \Type \ChannelType ;
7
- use Oro \Bundle \SecurityBundle \Annotation \AclAncestor ;
8
- use Oro \Bundle \SecurityBundle \Annotation \CsrfProtection ;
7
+ use Oro \Bundle \SecurityBundle \Attribute \AclAncestor ;
8
+ use Oro \Bundle \SecurityBundle \Attribute \CsrfProtection ;
9
9
use Sensio \Bundle \FrameworkExtraBundle \Configuration \ParamConverter ;
10
+ use Symfony \Component \Form \FormFactoryInterface ;
11
+ use Symfony \Contracts \Translation \TranslatorInterface ;
10
12
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
11
13
use Symfony \Component \HttpFoundation \JsonResponse ;
12
14
use Symfony \Component \HttpFoundation \Request ;
19
21
*/
20
22
class AjaxMollieController extends AbstractController
21
23
{
24
+ /** @var FormFactoryInterface */
25
+ protected $ formFactory ;
26
+
27
+ public function __construct (FormFactoryInterface $ formFactory )
28
+ {
29
+ $ this ->formFactory = $ formFactory ;
30
+ }
31
+
22
32
/**
23
33
* @Route("/validate-connection/{channelId}/", name="mollie_payment_validate_connection", methods={"POST"})
24
- * @ AclAncestor("oro_integration_update")
25
- * @ParamConverter("channel", class="OroIntegrationBundle: Channel", options={"id" = "channelId"})
26
- * @ CsrfProtection()
34
+ * #[ AclAncestor("oro_integration_update")]
35
+ * @ParamConverter("channel", class="Oro\Bundle\IntegrationBundle\Entity\ Channel", options={"id" = "channelId"})
36
+ * #[ CsrfProtection()]
27
37
*
28
38
* @param Request $request
29
39
* @param Channel|null $channel
@@ -36,7 +46,7 @@ public function validateConnectionAction(Request $request, Channel $channel = nu
36
46
$ channel = new Channel ();
37
47
}
38
48
39
- $ form = $ this ->createForm (
49
+ $ form = $ this ->formFactory -> create (
40
50
ChannelType::class,
41
51
$ channel
42
52
);
@@ -45,13 +55,13 @@ public function validateConnectionAction(Request $request, Channel $channel = nu
45
55
if (!$ form ->get ('transport ' )->get ('authToken ' )->isValid ()) {
46
56
return new JsonResponse ([
47
57
'success ' => false ,
48
- 'message ' => $ this ->get (' translator ' )->trans ('mollie.payment.config.authorization.verification.fail.message ' ),
58
+ 'message ' => $ this ->container -> get (TranslatorInterface::class )->trans ('mollie.payment.config.authorization.verification.fail.message ' ),
49
59
]);
50
60
}
51
61
52
62
return new JsonResponse ([
53
63
'success ' => true ,
54
- 'message ' => $ this ->get (' translator ' )->trans ('mollie.payment.config.authorization.verification.success.message ' ),
64
+ 'message ' => $ this ->container -> get (TranslatorInterface::class )->trans ('mollie.payment.config.authorization.verification.success.message ' ),
55
65
]);
56
66
}
57
67
}
0 commit comments