File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
src/CoreBundle/ServiceHelper Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ services:
110
110
- setKernel : [ '@kernel' ]
111
111
- setMessengerBus : [ '@messenger.bus.default' ]
112
112
- setValidator : [ '@validator' ]
113
+ - setSessionFactory : [ '@session.factory' ]
113
114
114
115
cocur_slugify :
115
116
lowercase : true
Original file line number Diff line number Diff line change 46
46
}
47
47
48
48
$ container = $ kernel ->getContainer ();
49
+ Container::setContainer ($ container );
50
+ $ session = Container::getLegacyHelper ()->getSession ();
51
+ $ request = Request::create ('/ ' );
52
+ $ request ->setSession ($ session );
53
+ $ container ->get ('request_stack ' )->push ($ request );
54
+ Container::setLegacyServices ($ container );
49
55
$ router = $ container ->get ('router ' );
50
56
$ context = $ router ->getContext ();
51
57
$ router ->setContext ($ context );
52
- Database::setManager ($ container ->get ('doctrine.orm.entity_manager ' ));
53
58
54
59
$ cliOptions = getopt ('' , ['url: ' ]);
55
60
if (!empty ($ cliOptions ['url ' ])) {
56
61
$ baseUrl = $ cliOptions ['url ' ];
57
62
$ context ->setBaseUrl ($ baseUrl );
58
63
}
59
-
60
- echo "CLI mode: EntityManager initialized. \n" ;
61
-
62
64
} else {
63
65
$ kernel = new Chamilo \Kernel ($ env , $ debug );
64
66
// Loading Request from Sonata. In order to use Sonata Pages Bundle.
Original file line number Diff line number Diff line change 6
6
7
7
namespace Chamilo \CoreBundle \ServiceHelper ;
8
8
9
+ use Symfony \Component \HttpFoundation \Session \SessionFactoryInterface ;
10
+ use Symfony \Component \HttpFoundation \Session \SessionInterface ;
9
11
use Symfony \Component \HttpKernel \KernelInterface ;
10
12
use Symfony \Component \Messenger \MessageBusInterface ;
11
13
use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
@@ -19,6 +21,7 @@ class ContainerHelper
19
21
private KernelInterface $ kernel ;
20
22
private MessageBusInterface $ messengerBus ;
21
23
private ValidatorInterface $ validator ;
24
+ private SessionFactoryInterface $ sessionFactory ;
22
25
23
26
public function getAuthorizationChecker (): AuthorizationCheckerInterface
24
27
{
@@ -69,4 +72,16 @@ public function setValidator(ValidatorInterface $validator): void
69
72
{
70
73
$ this ->validator = $ validator ;
71
74
}
75
+
76
+ public function getSession (): SessionInterface
77
+ {
78
+ return $ this ->sessionFactory ->createSession ();
79
+ }
80
+
81
+ public function setSessionFactory (SessionFactoryInterface $ sessionFactory ): ContainerHelper
82
+ {
83
+ $ this ->sessionFactory = $ sessionFactory ;
84
+
85
+ return $ this ;
86
+ }
72
87
}
You can’t perform that action at this time.
0 commit comments