1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Framework; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Component\Editor\Editor; |
10
|
|
|
use Chamilo\CoreBundle\Repository\AssetRepository; |
11
|
|
|
use Chamilo\CoreBundle\Repository\CareerRepository; |
12
|
|
|
use Chamilo\CoreBundle\Repository\CourseCategoryRepository; |
13
|
|
|
use Chamilo\CoreBundle\Repository\GradeBookCategoryRepository; |
14
|
|
|
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository; |
15
|
|
|
use Chamilo\CoreBundle\Repository\Node\CourseRepository; |
16
|
|
|
use Chamilo\CoreBundle\Repository\Node\IllustrationRepository; |
17
|
|
|
use Chamilo\CoreBundle\Repository\Node\MessageAttachmentRepository; |
18
|
|
|
use Chamilo\CoreBundle\Repository\Node\PersonalFileRepository; |
19
|
|
|
use Chamilo\CoreBundle\Repository\Node\UsergroupRepository; |
20
|
|
|
use Chamilo\CoreBundle\Repository\Node\UserRepository; |
21
|
|
|
use Chamilo\CoreBundle\Repository\PromotionRepository; |
22
|
|
|
use Chamilo\CoreBundle\Repository\SequenceRepository; |
23
|
|
|
use Chamilo\CoreBundle\Repository\SequenceResourceRepository; |
24
|
|
|
use Chamilo\CoreBundle\Repository\SessionRepository; |
25
|
|
|
use Chamilo\CoreBundle\Repository\SysAnnouncementRepository; |
26
|
|
|
use Chamilo\CoreBundle\Settings\SettingsManager; |
27
|
|
|
use Chamilo\CoreBundle\ToolChain; |
28
|
|
|
use Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository; |
29
|
|
|
use Chamilo\CourseBundle\Repository\CAnnouncementRepository; |
30
|
|
|
use Chamilo\CourseBundle\Repository\CAttendanceRepository; |
31
|
|
|
use Chamilo\CourseBundle\Repository\CBlogRepository; |
32
|
|
|
use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository; |
33
|
|
|
use Chamilo\CourseBundle\Repository\CCalendarEventRepository; |
34
|
|
|
use Chamilo\CourseBundle\Repository\CCourseDescriptionRepository; |
35
|
|
|
use Chamilo\CourseBundle\Repository\CDocumentRepository; |
36
|
|
|
use Chamilo\CourseBundle\Repository\CExerciseCategoryRepository; |
37
|
|
|
use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; |
38
|
|
|
use Chamilo\CourseBundle\Repository\CForumCategoryRepository; |
39
|
|
|
use Chamilo\CourseBundle\Repository\CForumPostRepository; |
40
|
|
|
use Chamilo\CourseBundle\Repository\CForumRepository; |
41
|
|
|
use Chamilo\CourseBundle\Repository\CForumThreadRepository; |
42
|
|
|
use Chamilo\CourseBundle\Repository\CGlossaryRepository; |
43
|
|
|
use Chamilo\CourseBundle\Repository\CGroupCategoryRepository; |
44
|
|
|
use Chamilo\CourseBundle\Repository\CGroupRepository; |
45
|
|
|
use Chamilo\CourseBundle\Repository\CLinkCategoryRepository; |
46
|
|
|
use Chamilo\CourseBundle\Repository\CLinkRepository; |
47
|
|
|
use Chamilo\CourseBundle\Repository\CLpCategoryRepository; |
48
|
|
|
use Chamilo\CourseBundle\Repository\CLpItemRepository; |
49
|
|
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
50
|
|
|
use Chamilo\CourseBundle\Repository\CNotebookRepository; |
51
|
|
|
use Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository; |
52
|
|
|
use Chamilo\CourseBundle\Repository\CQuizQuestionRepository; |
53
|
|
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
54
|
|
|
use Chamilo\CourseBundle\Repository\CShortcutRepository; |
55
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationAssignmentRepository; |
56
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository; |
57
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository; |
58
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository; |
59
|
|
|
use Chamilo\CourseBundle\Repository\CSurveyQuestionRepository; |
60
|
|
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
61
|
|
|
use Chamilo\CourseBundle\Repository\CThematicAdvanceRepository; |
62
|
|
|
use Chamilo\CourseBundle\Repository\CThematicPlanRepository; |
63
|
|
|
use Chamilo\CourseBundle\Repository\CThematicRepository; |
64
|
|
|
use Chamilo\CourseBundle\Repository\CWikiRepository; |
65
|
|
|
use Chamilo\CourseBundle\Settings\SettingsCourseManager; |
66
|
|
|
use Chamilo\LtiBundle\Repository\ExternalToolRepository; |
67
|
|
|
use Database; |
68
|
|
|
use Doctrine\ORM\EntityManager; |
69
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
70
|
|
|
use Symfony\Component\Form\FormFactory; |
71
|
|
|
use Symfony\Component\HttpFoundation\Request; |
72
|
|
|
use Symfony\Component\HttpFoundation\Session\Session; |
73
|
|
|
use Symfony\Component\Mailer\Mailer; |
74
|
|
|
use Symfony\Component\Routing\Router; |
75
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
76
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
77
|
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; |
78
|
|
|
use Symfony\Contracts\Translation\TranslatorInterface; |
79
|
|
|
use Twig\Environment; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Symfony services for the legacy Chamilo code. |
83
|
|
|
*/ |
84
|
|
|
class Container |
85
|
|
|
{ |
86
|
|
|
public static ?ContainerInterface $container = null; |
87
|
|
|
public static ?Request $request = null; |
88
|
|
|
public static ?TranslatorInterface $translator = null; |
89
|
|
|
public static Environment $twig; |
90
|
|
|
public static string $legacyTemplate = '@ChamiloCore/Layout/layout_one_col.html.twig'; |
91
|
|
|
|
92
|
|
|
public static function setContainer(ContainerInterface $container): void |
93
|
|
|
{ |
94
|
|
|
self::$container = $container; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public static function getParameter(string $parameter) |
98
|
|
|
{ |
99
|
|
|
if (self::$container->hasParameter($parameter)) { |
|
|
|
|
100
|
|
|
return self::$container->getParameter($parameter); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return false; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public static function getEnvironment() |
110
|
|
|
{ |
111
|
|
|
return self::$container->get('kernel')->getEnvironment(); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public static function getLogDir(): string |
115
|
|
|
{ |
116
|
|
|
return self::$container->get('kernel')->getLogDir(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public static function getCacheDir(): string |
120
|
|
|
{ |
121
|
|
|
return self::$container->get('kernel')->getCacheDir().'/'; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public static function getProjectDir() |
128
|
|
|
{ |
129
|
|
|
if (null !== self::$container) { |
130
|
|
|
return self::$container->get('kernel')->getProjectDir().'/'; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
return str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return bool |
138
|
|
|
*/ |
139
|
|
|
public static function isInstalled() |
140
|
|
|
{ |
141
|
|
|
return self::$container->get('kernel')->isInstalled(); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return Environment |
146
|
|
|
*/ |
147
|
|
|
public static function getTwig() |
148
|
|
|
{ |
149
|
|
|
return self::$twig; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @return Editor |
154
|
|
|
*/ |
155
|
|
|
public static function getHtmlEditor() |
156
|
|
|
{ |
157
|
|
|
return self::$container->get('chamilo_core.html_editor'); |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return null|Request |
162
|
|
|
*/ |
163
|
|
|
public static function getRequest() |
164
|
|
|
{ |
165
|
|
|
if (null === self::$container) { |
166
|
|
|
return null; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
if (!empty(self::$request)) { |
170
|
|
|
return self::$request; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
return self::$container->get('request_stack')->getCurrentRequest(); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public static function setRequest(Request $request): void |
177
|
|
|
{ |
178
|
|
|
self::$request = $request; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return false|Session |
183
|
|
|
*/ |
184
|
|
|
public static function getSession() |
185
|
|
|
{ |
186
|
|
|
if (null !== self::$container) { |
187
|
|
|
return self::$container->get('session'); |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
return false; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return AuthorizationChecker |
195
|
|
|
*/ |
196
|
|
|
public static function getAuthorizationChecker() |
197
|
|
|
{ |
198
|
|
|
return self::$container->get('security.authorization_checker'); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return TokenStorage|TokenStorageInterface |
203
|
|
|
*/ |
204
|
|
|
public static function getTokenStorage() |
205
|
|
|
{ |
206
|
|
|
return self::$container->get('security.token_storage'); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @return TranslatorInterface |
211
|
|
|
*/ |
212
|
|
|
public static function getTranslator() |
213
|
|
|
{ |
214
|
|
|
if (null !== self::$translator) { |
215
|
|
|
return self::$translator; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
//if (self::$container->has('translator')) { |
219
|
|
|
return self::$container->get('translator'); |
220
|
|
|
//} |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
public static function getMailer(): Mailer |
224
|
|
|
{ |
225
|
|
|
return self::$container->get(Mailer::class); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
public static function getSettingsManager(): SettingsManager |
229
|
|
|
{ |
230
|
|
|
return self::$container->get('chamilo.settings.manager'); |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
public static function getCourseSettingsManager(): SettingsCourseManager |
234
|
|
|
{ |
235
|
|
|
return self::$container->get(SettingsCourseManager::class); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return EntityManager |
240
|
|
|
*/ |
241
|
|
|
public static function getEntityManager() |
242
|
|
|
{ |
243
|
|
|
return Database::getManager(); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
public static function getAssetRepository(): AssetRepository |
247
|
|
|
{ |
248
|
|
|
return self::$container->get(AssetRepository::class); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
public static function getAttendanceRepository(): CAttendanceRepository |
252
|
|
|
{ |
253
|
|
|
return self::$container->get(CAttendanceRepository::class); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
public static function getAnnouncementRepository(): CAnnouncementRepository |
257
|
|
|
{ |
258
|
|
|
return self::$container->get(CAnnouncementRepository::class); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
public static function getAccessUrlRepository(): AccessUrlRepository |
262
|
|
|
{ |
263
|
|
|
return self::$container->get(AccessUrlRepository::class); |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
public static function getAnnouncementAttachmentRepository(): CAnnouncementAttachmentRepository |
267
|
|
|
{ |
268
|
|
|
return self::$container->get(CAnnouncementAttachmentRepository::class); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
public static function getBlogRepository(): CBlogRepository |
272
|
|
|
{ |
273
|
|
|
return self::$container->get(CBlogRepository::class); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
public static function getCourseRepository(): CourseRepository |
277
|
|
|
{ |
278
|
|
|
return self::$container->get(CourseRepository::class); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
public static function getCareerRepository(): CareerRepository |
282
|
|
|
{ |
283
|
|
|
return self::$container->get(CareerRepository::class); |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
public static function getCourseCategoryRepository(): CourseCategoryRepository |
287
|
|
|
{ |
288
|
|
|
return self::$container->get(CourseCategoryRepository::class); |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
public static function getCourseDescriptionRepository(): CCourseDescriptionRepository |
292
|
|
|
{ |
293
|
|
|
return self::$container->get(CCourseDescriptionRepository::class); |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
public static function getCalendarEventRepository(): CCalendarEventRepository |
297
|
|
|
{ |
298
|
|
|
return self::$container->get(CCalendarEventRepository::class); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public static function getCalendarEventAttachmentRepository(): CCalendarEventAttachmentRepository |
302
|
|
|
{ |
303
|
|
|
return self::$container->get(CCalendarEventAttachmentRepository::class); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
public static function getDocumentRepository(): CDocumentRepository |
307
|
|
|
{ |
308
|
|
|
return self::$container->get(CDocumentRepository::class); |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
public static function getExerciseCategoryRepository(): CExerciseCategoryRepository |
312
|
|
|
{ |
313
|
|
|
return self::$container->get(CExerciseCategoryRepository::class); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
public static function getGlossaryRepository(): CGlossaryRepository |
317
|
|
|
{ |
318
|
|
|
return self::$container->get(CGlossaryRepository::class); |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
public static function getGradeBookCategoryRepository(): GradeBookCategoryRepository |
322
|
|
|
{ |
323
|
|
|
return self::$container->get(GradeBookCategoryRepository::class); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
public static function getGroupRepository(): CGroupRepository |
327
|
|
|
{ |
328
|
|
|
return self::$container->get(CGroupRepository::class); |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
public static function getGroupCategoryRepository(): CGroupCategoryRepository |
332
|
|
|
{ |
333
|
|
|
return self::$container->get(CGroupCategoryRepository::class); |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
public static function getForumRepository(): CForumRepository |
337
|
|
|
{ |
338
|
|
|
return self::$container->get(CForumRepository::class); |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
public static function getForumCategoryRepository(): CForumCategoryRepository |
342
|
|
|
{ |
343
|
|
|
return self::$container->get(CForumCategoryRepository::class); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
public static function getForumPostRepository(): CForumPostRepository |
347
|
|
|
{ |
348
|
|
|
return self::$container->get(CForumPostRepository::class); |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
public static function getForumAttachmentRepository(): CForumAttachmentRepository |
352
|
|
|
{ |
353
|
|
|
return self::$container->get(CForumAttachmentRepository::class); |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
public static function getForumThreadRepository(): CForumThreadRepository |
357
|
|
|
{ |
358
|
|
|
return self::$container->get(CForumThreadRepository::class); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
public static function getIllustrationRepository(): IllustrationRepository |
362
|
|
|
{ |
363
|
|
|
return self::$container->get(IllustrationRepository::class); |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
public static function getQuizRepository(): CQuizRepository |
367
|
|
|
{ |
368
|
|
|
return self::$container->get(CQuizRepository::class); |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
public static function getQuestionRepository(): CQuizQuestionRepository |
372
|
|
|
{ |
373
|
|
|
return self::$container->get(CQuizQuestionRepository::class); |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
public static function getQuestionCategoryRepository(): CQuizQuestionCategoryRepository |
377
|
|
|
{ |
378
|
|
|
return self::$container->get(CQuizQuestionCategoryRepository::class); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
public static function getLinkRepository(): CLinkRepository |
382
|
|
|
{ |
383
|
|
|
return self::$container->get(CLinkRepository::class); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
public static function getLinkCategoryRepository(): CLinkCategoryRepository |
387
|
|
|
{ |
388
|
|
|
return self::$container->get(CLinkCategoryRepository::class); |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
public static function getLpRepository(): CLpRepository |
392
|
|
|
{ |
393
|
|
|
return self::$container->get(CLpRepository::class); |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
public static function getLpItemRepository(): CLpItemRepository |
397
|
|
|
{ |
398
|
|
|
return self::$container->get(CLpItemRepository::class); |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
public static function getLpCategoryRepository(): CLpCategoryRepository |
402
|
|
|
{ |
403
|
|
|
return self::$container->get(CLpCategoryRepository::class); |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
public static function getMessageAttachmentRepository(): MessageAttachmentRepository |
407
|
|
|
{ |
408
|
|
|
return self::$container->get(MessageAttachmentRepository::class); |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
public static function getNotebookRepository(): CNotebookRepository |
412
|
|
|
{ |
413
|
|
|
return self::$container->get(CNotebookRepository::class); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
public static function getPersonalFileRepository(): PersonalFileRepository |
417
|
|
|
{ |
418
|
|
|
return self::$container->get(PersonalFileRepository::class); |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
public static function getPromotionRepository(): PromotionRepository |
422
|
|
|
{ |
423
|
|
|
return self::$container->get(PromotionRepository::class); |
424
|
|
|
} |
425
|
|
|
|
426
|
|
|
public static function getUserRepository(): UserRepository |
427
|
|
|
{ |
428
|
|
|
return self::$container->get(UserRepository::class); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
public static function getUsergroupRepository(): UsergroupRepository |
432
|
|
|
{ |
433
|
|
|
return self::$container->get(UsergroupRepository::class); |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
public static function getShortcutRepository(): CShortcutRepository |
437
|
|
|
{ |
438
|
|
|
return self::$container->get(CShortcutRepository::class); |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
public static function getStudentPublicationRepository(): CStudentPublicationRepository |
442
|
|
|
{ |
443
|
|
|
return self::$container->get(CStudentPublicationRepository::class); |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
public static function getStudentPublicationAssignmentRepository(): CStudentPublicationAssignmentRepository |
447
|
|
|
{ |
448
|
|
|
return self::$container->get(CStudentPublicationAssignmentRepository::class); |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
public static function getStudentPublicationCommentRepository(): CStudentPublicationCommentRepository |
452
|
|
|
{ |
453
|
|
|
return self::$container->get(CStudentPublicationCommentRepository::class); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
public static function getStudentPublicationCorrectionRepository(): CStudentPublicationCorrectionRepository |
457
|
|
|
{ |
458
|
|
|
return self::$container->get(CStudentPublicationCorrectionRepository::class); |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
public static function getSequenceResourceRepository(): SequenceResourceRepository |
462
|
|
|
{ |
463
|
|
|
return self::$container->get(SequenceResourceRepository::class); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
public static function getSequenceRepository(): SequenceRepository |
467
|
|
|
{ |
468
|
|
|
return self::$container->get(SequenceRepository::class); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
public static function getSessionRepository(): SessionRepository |
472
|
|
|
{ |
473
|
|
|
return self::$container->get(SessionRepository::class); |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
public static function getSurveyRepository(): CSurveyRepository |
477
|
|
|
{ |
478
|
|
|
return self::$container->get(CSurveyRepository::class); |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
public static function getSurveyQuestionRepository(): CSurveyQuestionRepository |
482
|
|
|
{ |
483
|
|
|
return self::$container->get(CSurveyQuestionRepository::class); |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
public static function getSysAnnouncementRepository(): SysAnnouncementRepository |
487
|
|
|
{ |
488
|
|
|
return self::$container->get(SysAnnouncementRepository::class); |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
public static function getThematicRepository(): CThematicRepository |
492
|
|
|
{ |
493
|
|
|
return self::$container->get(CThematicRepository::class); |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
public static function getThematicPlanRepository(): CThematicPlanRepository |
497
|
|
|
{ |
498
|
|
|
return self::$container->get(CThematicPlanRepository::class); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
public static function getThematicAdvanceRepository(): CThematicAdvanceRepository |
502
|
|
|
{ |
503
|
|
|
return self::$container->get(CThematicAdvanceRepository::class); |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
public static function getWikiRepository(): CWikiRepository |
507
|
|
|
{ |
508
|
|
|
return self::$container->get(CWikiRepository::class); |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
public static function getFormFactory(): FormFactory |
512
|
|
|
{ |
513
|
|
|
return self::$container->get('form.factory'); |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
public static function getExternalToolRepository(): ExternalToolRepository |
517
|
|
|
{ |
518
|
|
|
return self::$container->get(ExternalToolRepository::class); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @param string $type error|success|warning|danger |
523
|
|
|
*/ |
524
|
|
|
public static function addFlash(string $message, string $type = 'success'): void |
525
|
|
|
{ |
526
|
|
|
$session = self::getSession(); |
527
|
|
|
$session->getFlashBag()->add($type, $message); |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
public static function getRouter(): Router |
531
|
|
|
{ |
532
|
|
|
return self::$container->get('router'); |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
public static function getToolChain(): ToolChain |
536
|
|
|
{ |
537
|
|
|
return self::$container->get(ToolChain::class); |
538
|
|
|
} |
539
|
|
|
|
540
|
|
|
public static function setLegacyServices(ContainerInterface $container): void |
541
|
|
|
{ |
542
|
|
|
$doctrine = $container->get('doctrine'); |
543
|
|
|
Database::setConnection($doctrine->getConnection()); |
544
|
|
|
/** @var EntityManager $em */ |
545
|
|
|
$em = $doctrine->getManager(); |
546
|
|
|
Database::setManager($em); |
547
|
|
|
} |
548
|
|
|
} |
549
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.