Fixing deprecations

pull/5329/head
Angel Fernando Quiroz Campos 1 year ago
parent a50c75f642
commit 2d3419b20e
  1. 1
      composer.json
  2. 2
      src/CoreBundle/Controller/AccountController.php
  3. 2
      src/CoreBundle/Controller/Admin/PluginsController.php
  4. 6
      src/CoreBundle/Controller/Admin/SettingsController.php
  5. 4
      src/CoreBundle/Controller/AssetController.php
  6. 13
      src/CoreBundle/Controller/ChatController.php
  7. 4
      src/CoreBundle/Controller/ContactController.php
  8. 5
      src/CoreBundle/Controller/EditorController.php
  9. 8
      src/CoreBundle/Controller/ExceptionController.php
  10. 8
      src/CoreBundle/Controller/FileManagerController.php
  11. 31
      src/CoreBundle/Controller/IndexController.php
  12. 2
      src/CoreBundle/Controller/NewsController.php
  13. 18
      src/CoreBundle/Controller/OnlineController.php
  14. 12
      src/CoreBundle/Controller/ResourceController.php
  15. 5
      src/CoreBundle/Controller/SessionController.php
  16. 4
      src/CoreBundle/Controller/SocialController.php
  17. 2
      src/CoreBundle/Controller/ThemeController.php
  18. 5
      src/CoreBundle/Controller/ToolController.php
  19. 5
      src/CoreBundle/Controller/UserController.php
  20. 10
      src/CoreBundle/DataFixtures/AccessGroupFixtures.php
  21. 22
      src/CoreBundle/DataFixtures/AccessUserFixtures.php
  22. 16
      src/CoreBundle/DataFixtures/AccessUserUrlFixtures.php
  23. 16
      src/CoreBundle/DataFixtures/PageFixtures.php
  24. 38
      src/CoreBundle/DataFixtures/TicketFixtures.php
  25. 11
      src/CoreBundle/EventListener/AssetListener.php
  26. 11
      src/CoreBundle/EventListener/CourseAccessListener.php
  27. 20
      src/CoreBundle/EventListener/CourseListener.php
  28. 12
      src/CoreBundle/EventListener/ExceptionListener.php
  29. 12
      src/CoreBundle/EventListener/HTTPExceptionListener.php
  30. 25
      src/CoreBundle/EventListener/LegacyListener.php
  31. 11
      src/CoreBundle/EventListener/LoginSuccessHandler.php
  32. 16
      src/CoreBundle/EventListener/LogoutListener.php
  33. 11
      src/CoreBundle/EventListener/SessionAccessListener.php
  34. 11
      src/CoreBundle/EventListener/SettingListener.php
  35. 12
      src/CoreBundle/EventListener/TwigListener.php
  36. 2
      src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php
  37. 3
      src/CoreBundle/Framework/Exporter.php
  38. 14
      src/CoreBundle/Migrations/AbstractMigrationChamilo.php
  39. 2
      src/CoreBundle/Migrations/Schema/V200/Version20170625122900.php
  40. 9
      src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php
  41. 7
      src/CoreBundle/Migrations/Schema/V200/Version20191206150030.php
  42. 7
      src/CoreBundle/Migrations/Schema/V200/Version20201010224040.php
  43. 8
      src/CoreBundle/Migrations/Schema/V200/Version20201212114910.php
  44. 14
      src/CoreBundle/Migrations/Schema/V200/Version20201212195011.php
  45. 15
      src/CoreBundle/Migrations/Schema/V200/Version20201212195112.php
  46. 18
      src/CoreBundle/Migrations/Schema/V200/Version20201212203625.php
  47. 16
      src/CoreBundle/Migrations/Schema/V200/Version20201215072918.php
  48. 16
      src/CoreBundle/Migrations/Schema/V200/Version20201215135838.php
  49. 12
      src/CoreBundle/Migrations/Schema/V200/Version20201215141131.php
  50. 26
      src/CoreBundle/Migrations/Schema/V200/Version20201215142610.php
  51. 23
      src/CoreBundle/Migrations/Schema/V200/Version20201215153517.php
  52. 28
      src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php
  53. 26
      src/CoreBundle/Migrations/Schema/V200/Version20201216105331.php
  54. 22
      src/CoreBundle/Migrations/Schema/V200/Version20201216110722.php
  55. 16
      src/CoreBundle/Migrations/Schema/V200/Version20201216120654.php
  56. 14
      src/CoreBundle/Migrations/Schema/V200/Version20201216122012.php
  57. 9
      src/CoreBundle/Migrations/Schema/V200/Version20201216132000.php
  58. 23
      src/CoreBundle/Migrations/Schema/V200/Version20201217124011.php
  59. 16
      src/CoreBundle/Migrations/Schema/V200/Version20201218132719.php
  60. 21
      src/CoreBundle/Migrations/Schema/V200/Version20201219115244.php
  61. 13
      src/CoreBundle/Migrations/Schema/V200/Version20210205082253.php
  62. 12
      src/CoreBundle/Migrations/Schema/V200/Version20210221082033.php
  63. 7
      src/CoreBundle/Migrations/Schema/V200/Version20210813150011.php
  64. 6
      src/CoreBundle/Migrations/Schema/V200/Version20210923090920.php
  65. 14
      src/CoreBundle/Migrations/Schema/V200/Version20210930130343.php
  66. 13
      src/CoreBundle/Migrations/Schema/V200/Version20211005154000.php
  67. 6
      src/CoreBundle/Migrations/Schema/V200/Version20211029123419.php
  68. 9
      src/CoreBundle/Migrations/Schema/V200/Version20230204150030.php
  69. 28
      src/CoreBundle/Migrations/Schema/V200/Version20230215072918.php
  70. 3
      src/CoreBundle/Migrations/Schema/V200/Version20230216122900.php
  71. 4
      src/CoreBundle/Migrations/Schema/V200/Version20230315115019.php
  72. 5
      src/CoreBundle/Migrations/Schema/V200/Version20230321164019.php
  73. 8
      src/CoreBundle/Migrations/Schema/V200/Version20230615213500.php
  74. 3
      src/CoreBundle/Migrations/Schema/V200/Version20230720143000.php
  75. 15
      src/CoreBundle/Migrations/Schema/V200/Version20230720222140.php
  76. 3
      src/CoreBundle/Migrations/Schema/V200/Version20230904173400.php
  77. 9
      src/CoreBundle/Migrations/Schema/V200/Version20230913162700.php
  78. 13
      src/CoreBundle/Migrations/Schema/V200/Version20231012185600.php
  79. 10
      src/CoreBundle/Migrations/Schema/V200/Version20231022124700.php
  80. 16
      src/CoreBundle/Migrations/Schema/V200/Version20231026231100.php
  81. 6
      src/CoreBundle/Migrations/Schema/V200/Version20231110194300.php
  82. 10
      src/CoreBundle/Migrations/Schema/V200/Version20240112103400.php
  83. 21
      src/CoreBundle/Migrations/Schema/V200/Version20240112191200.php
  84. 11
      src/CoreBundle/Migrations/Schema/V200/Version20240122221400.php
  85. 12
      src/CoreBundle/Migrations/Schema/V200/Version20240128205500.php
  86. 14
      src/CoreBundle/Migrations/Schema/V200/Version20240130161800.php
  87. 10
      src/CoreBundle/Migrations/Schema/V200/Version20240202122300.php
  88. 8
      src/CoreBundle/Migrations/Schema/V200/Version20240310160200.php
  89. 6
      src/LtiBundle/Component/OutcomeRequest.php
  90. 40
      src/LtiBundle/Controller/AdminController.php
  91. 76
      src/LtiBundle/Controller/CourseController.php
  92. 19
      src/LtiBundle/Controller/ServiceController.php

@ -58,6 +58,7 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-simplexml": "*",
"ext-soap": "*",
"ext-xml": "*",
"ext-xmlreader": "*",

@ -27,7 +27,7 @@ class AccountController extends BaseController
use ControllerTrait;
#[Route('/edit', name: 'chamilo_core_account_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, UserRepository $userRepository, IllustrationRepository $illustrationRepo, SettingsManager $settingsManager): Response
public function edit(Request $request, UserRepository $userRepository, IllustrationRepository $illustrationRepo, SettingsManager $settingsManager): Response
{
$user = $this->getUser();

@ -32,7 +32,7 @@ class PluginsController extends BaseController
#[IsGranted('ROLE_ADMIN')]
#[Route('/add', name: 'chamilo_core_plugins', methods: ['GET', 'POST'])]
public function pluginsAddAction(): Response
public function pluginsAdd(): Response
{
$appPlugin = new AppPlugin();
$allPlugins = $appPlugin->read_plugins_from_path();

@ -23,7 +23,7 @@ class SettingsController extends BaseController
use ControllerTrait;
#[Route('/settings', name: 'admin_settings')]
public function indexAction(): Response
public function index(): Response
{
return $this->redirectToRoute('chamilo_platform_settings', ['namespace' => 'platform']);
}
@ -33,7 +33,7 @@ class SettingsController extends BaseController
*/
#[IsGranted('ROLE_ADMIN')]
#[Route('/settings/search_settings', name: 'chamilo_platform_settings_search')]
public function searchSettingAction(Request $request): Response
public function searchSetting(Request $request): Response
{
$manager = $this->getSettingsManager();
$formList = [];
@ -93,7 +93,7 @@ class SettingsController extends BaseController
*/
#[IsGranted('ROLE_ADMIN')]
#[Route('/settings/{namespace}', name: 'chamilo_platform_settings')]
public function updateSettingAction(Request $request, string $namespace): Response
public function updateSetting(Request $request, string $namespace): Response
{
$manager = $this->getSettingsManager();
$url = $this->getAccessUrl();

@ -22,9 +22,7 @@ class AssetController
{
use ControllerTrait;
/**
* @Route("/{category}/{path}", methods={"GET"}, requirements={"path"=".+"}, name="chamilo_core_asset_showfile")
*/
#[Route(path: '/{category}/{path}', methods: ['GET'], requirements: ['path' => '.+'], name: 'chamilo_core_asset_showfile')]
public function showFile(
string $category,
string $path,

@ -25,13 +25,10 @@ class ChatController extends AbstractResourceController implements CourseControl
use CourseControllerTrait;
use ResourceControllerTrait;
/**
* @Route("/resources/chat/", name="chat_home", options={"expose"=true})
*/
public function indexAction(Request $request): Response
#[Route(path: '/resources/chat/', name: 'chat_home', options: ['expose' => true])]
public function index(): Response
{
Event::event_access_tool(TOOL_CHAT);
$logInfo = [
'tool' => TOOL_CHAT,
'action' => 'start',
@ -48,10 +45,8 @@ class ChatController extends AbstractResourceController implements CourseControl
);
}
/**
* @Route("/resources/chat/conversations/", name="chat_ajax", options={"expose"=true})
*/
public function ajaxAction(Request $request, ResourceNodeRepository $repo): Response
#[Route(path: '/resources/chat/conversations/', name: 'chat_ajax', options: ['expose' => true])]
public function ajax(Request $request, ResourceNodeRepository $repo): Response
{
if (!api_protect_course_script(false)) {
exit;

@ -16,9 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
class ContactController extends AbstractController
{
/**
* @Route("/contact", name="contact")
*/
#[Route(path: '/contact', name: 'contact')]
public function index(Request $request, MailerInterface $mailer, SettingsManager $settingsManager)
{
$form = $this->createForm(ContactType::class);

@ -24,10 +24,9 @@ class EditorController extends BaseController
/**
* Get templates (left column when creating a document).
*
* @Route("/templates", methods={"GET"}, name="editor_templates")
*/
public function editorTemplatesAction(TranslatorInterface $translator, RouterInterface $router): Response
#[Route(path: '/templates', methods: ['GET'], name: 'editor_templates')]
public function editorTemplates(TranslatorInterface $translator, RouterInterface $router): Response
{
$editor = new CkEditor(
$translator,

@ -16,7 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
class ExceptionController extends AbstractController
{
public function showAction(Exception $exception): Response
public function show(Exception $exception): Response
{
if ('dev' === (string) $this->getParameter('app_env')) {
throw new HttpException($exception->getCode(), $exception->getMessage());
@ -52,10 +52,8 @@ class ExceptionController extends AbstractController
]);
}
/**
* @Route("/error")
*/
public function errorAction(Request $request): Response
#[Route(path: '/error')]
public function error(Request $request): Response
{
$message = $request->getSession()->get('error_message', '');
$exception = new FlattenException();

@ -43,7 +43,7 @@ class FileManagerController extends AbstractController
}
#[Route('/upload', name: 'file_manager_upload', methods: ['POST'])]
public function upload(Request $request): JsonResponse
public function upload(): JsonResponse
{
// Implement logic to upload files
// This part will handle receiving and storing uploaded files
@ -81,21 +81,21 @@ class FileManagerController extends AbstractController
}
#[Route('/create-folder', name: 'file_manager_create_folder', methods: ['POST'])]
public function createFolder(Request $request): JsonResponse
public function createFolder(): JsonResponse
{
// Implement logic to create new folders
return $this->json(['message' => 'Folder created successfully']);
}
#[Route('/rename', name: 'file_manager_rename', methods: ['POST'])]
public function rename(Request $request): JsonResponse
public function rename(): JsonResponse
{
// Implement logic to rename files/folders
return $this->json(['message' => 'File/folder renamed successfully']);
}
#[Route('/delete', name: 'file_manager_delete', methods: ['DELETE'])]
public function delete(Request $request): JsonResponse
public function delete(): JsonResponse
{
// Implement logic to delete files/folders
return $this->json(['message' => 'File/folder deleted successfully']);

@ -14,24 +14,23 @@ use Symfony\Component\Routing\Annotation\Route;
class IndexController extends BaseController
{
/**
* @Route("/", name="index", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/home", name="home", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/login", name="login", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/faq", name="faq", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/demo", name="demo", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/course/{cid}/home", name="chamilo_core_course_home")
* @Route("/courses", name="courses", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/catalogue/{slug}", name="catalogue", methods={"GET", "POST"}, options={"expose"=true})
* @Route("/resources/document/{nodeId}/manager", methods={"GET"}, name="resources_filemanager")
* @Route("/account/home", name="account", options={"expose"=true}, name="chamilo_core_account_home")
* @Route("/social", name="social", options={"expose"=true}, name="chamilo_core_socialnetwork")
* @Route("/admin", name="admin", options={"expose"=true})
*/
#[Route('/', name: 'index', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/sessions', name: 'sessions')]
#[Route('/sessions/{extra}', name: 'sessions_options')]
#[Route('/admin/configuration/colors', name: 'configuration_colors')]
public function indexAction(): Response
#[Route('/home', name: 'home', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/login', name: 'login', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/faq', name: 'faq', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/demo', name: 'demo', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/course/{cid}/home', name: 'chamilo_core_course_home')]
#[Route('/courses', name: 'courses', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/catalogue/{slug}', name: 'catalogue', options: ['expose' => true], methods: ['GET', 'POST'])]
#[Route('/resources/ccalendarevent', name: 'resources_ccalendarevent', methods: ['GET'])]
#[Route('/resources/document/{nodeId}/manager', name: 'resources_filemanager', methods: ['GET'])]
#[Route('/account/home', name: 'chamilo_core_account_home', options: ['expose' => true])]
#[Route('/social', name: 'chamilo_core_socialnetwork', options: ['expose' => true])]
#[Route('/admin', name: 'admin', options: ['expose' => true])]
public function index(): Response
{
return $this->render('@ChamiloCore/Index/vue.html.twig');
}
@ -69,7 +68,7 @@ class IndexController extends BaseController
*/
#[Route('/toggle_student_view', methods: ['GET'])]
#[Security("is_granted('ROLE_TEACHER')")]
public function toggleStudentViewAction(Request $request, SettingsManager $settingsManager): Response
public function toggleStudentView(Request $request, SettingsManager $settingsManager): Response
{
if (!api_is_allowed_to_edit(false, false, false, false)) {
throw $this->createAccessDeniedException();

@ -22,7 +22,7 @@ class NewsController extends BaseController
use ControllerTrait;
#[Route('/list', name: 'news_index', methods: ['GET'])]
public function indexAction(SysAnnouncementRepository $sysAnnouncementRepository): Response
public function index(SysAnnouncementRepository $sysAnnouncementRepository): Response
{
/** @var User $user */
$user = $this->getUser();

@ -16,10 +16,8 @@ use Symfony\Component\Routing\Annotation\Route;
#[Route('/online')]
class OnlineController extends BaseController
{
/**
* @Route("/", name="users_online", methods={"GET"}, options={"expose"=true})
*/
public function indexAction(): Response
#[Route(path: '/', name: 'users_online', methods: ['GET'], options: ['expose' => true])]
public function index(): Response
{
// @todo don't use legacy code
$users = who_is_online(0, MAX_ONLINE_USERS);
@ -33,10 +31,8 @@ class OnlineController extends BaseController
);
}
/**
* @Route("/in_course/{cidReq}", name="online_users_in_course", methods={"GET", "POST"}, options={"expose"=true})
*/
public function onlineUsersInCoursesAction(string $cidReq): Response
#[Route(path: '/in_course/{cidReq}', name: 'online_users_in_course', methods: ['GET', 'POST'], options: ['expose' => true])]
public function onlineUsersInCourses(string $cidReq): Response
{
// @todo don't use legacy code
$users = who_is_online_in_this_course(
@ -57,10 +53,8 @@ class OnlineController extends BaseController
);
}
/**
* @Route("/in_sessions", name="online_users_in_session", methods={"GET", "POST"}, options={"expose"=true})
*/
public function onlineUsersInCoursesSessionAction(int $id = 0): Response
#[Route(path: '/in_sessions', name: 'online_users_in_session', methods: ['GET', 'POST'], options: ['expose' => true])]
public function onlineUsersInCoursesSession(int $id = 0): Response
{
$users = who_is_online_in_this_course(
0,

@ -54,10 +54,8 @@ class ResourceController extends AbstractResourceController implements CourseCon
use GradebookControllerTrait;
use ResourceControllerTrait;
/**
* @Route("/{tool}/{type}/{id}/disk_space", methods={"GET", "POST"}, name="chamilo_core_resource_disk_space")
*/
public function diskSpaceAction(Request $request): Response
#[Route(path: '/{tool}/{type}/{id}/disk_space', methods: ['GET', 'POST'], name: 'chamilo_core_resource_disk_space')]
public function diskSpace(Request $request): Response
{
$nodeId = $request->get('id');
$repository = $this->getRepositoryFromRequest($request);
@ -131,7 +129,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
* View file of a resource node.
*/
#[Route('/{tool}/{type}/{id}/view', name: 'chamilo_core_resource_view', methods: ['GET'])]
public function viewAction(Request $request, EntityManagerInterface $entityManager): Response
public function view(Request $request, EntityManagerInterface $entityManager): Response
{
$id = $request->get('id');
$filter = (string) $request->get('filter'); // See filters definitions in /config/services.yml.
@ -172,7 +170,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
* @return RedirectResponse|void
*/
#[Route('/{tool}/{type}/{id}/link', name: 'chamilo_core_resource_link', methods: ['GET'])]
public function linkAction(Request $request, RouterInterface $router, CLinkRepository $cLinkRepository)
public function link(Request $request, RouterInterface $router, CLinkRepository $cLinkRepository): RedirectResponse
{
$tool = $request->get('tool');
$type = $request->get('type');
@ -211,7 +209,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
* @return RedirectResponse|StreamedResponse
*/
#[Route('/{tool}/{type}/{id}/download', name: 'chamilo_core_resource_download', methods: ['GET'])]
public function downloadAction(Request $request, EntityManagerInterface $entityManager)
public function download(Request $request, EntityManagerInterface $entityManager)
{
$id = $request->get('id');
$resourceNode = $this->getResourceNodeRepository()->findOneBy(['uuid' => $id]);

@ -36,11 +36,10 @@ use UserManager;
class SessionController extends AbstractController
{
/**
* @Route("/{sid}/about", name="chamilo_core_session_about")
*
* @Entity("session", expr="repository.find(sid)")
*/
public function aboutAction(
#[Route(path: '/{sid}/about', name: 'chamilo_core_session_about')]
public function about(
Request $request,
Session $session,
IllustrationRepository $illustrationRepo,

@ -728,7 +728,7 @@ class SocialController extends AbstractController
}
#[Route('/group-action', name: 'chamilo_core_social_group_action')]
public function groupAction(
public function group(
Request $request,
UsergroupRepository $usergroupRepository,
EntityManagerInterface $em,
@ -849,7 +849,7 @@ class SocialController extends AbstractController
}
#[Route('/user-action', name: 'chamilo_core_social_user_action')]
public function userAction(
public function user(
Request $request,
UserRepository $userRepository,
MessageRepository $messageRepository,

@ -21,7 +21,7 @@ class ThemeController extends AbstractController
) {}
#[Route('/theme/colors.css', name: 'chamilo_color_theme', methods: ['GET'])]
public function colorThemeAction(): Response
public function colorTheme(): Response
{
$response = new Response('');

@ -19,10 +19,9 @@ class ToolController extends AbstractController
* Updates the table tool and resource_type with the content of tools.yml.
*
* @Security("is_granted('ROLE_ADMIN')")
*
* @Route("/update", methods={"GET"})
*/
public function profileAction(ToolChain $toolChain): Response
#[Route(path: '/update', methods: ['GET'])]
public function profile(ToolChain $toolChain): Response
{
$toolChain->createTools();

@ -21,10 +21,9 @@ class UserController extends AbstractController
{
/**
* Public profile.
*
* @Route("/{username}", methods={"GET"}, name="chamilo_core_user_profile")
*/
public function profileAction(string $username, UserRepository $userRepository, IllustrationRepository $illustrationRepository): Response
#[Route(path: '/{username}', methods: ['GET'], name: 'chamilo_core_user_profile')]
public function profile(string $username, UserRepository $userRepository, IllustrationRepository $illustrationRepository): Response
{
$user = $userRepository->findByUsername($username);

@ -14,17 +14,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class AccessGroupFixtures extends Fixture implements ContainerAwareInterface
{
private ContainerInterface $container;
public function __construct(
private GroupRepository $groupRepository
) {}
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
$this->groupRepository = $container->get(GroupRepository::class);
}
public function load(ObjectManager $manager): void
{
/** @var GroupRepository $repo */
$repo = $this->container->get(GroupRepository::class);
$repo->createDefaultGroups($this);
$this->groupRepository->createDefaultGroups($this);
}
}

@ -20,19 +20,21 @@ class AccessUserFixtures extends Fixture implements ContainerAwareInterface
public const ANON_USER_REFERENCE = 'anon';
public const ACCESS_URL_REFERENCE = 'accessUrl';
private ContainerInterface $container;
public function __construct(
private ToolChain $toolChain,
private UserRepository $userRepository
) {}
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
$this->toolChain = $container->get(ToolChain::class);
$this->userRepository = $container->get(UserRepository::class);
}
public function load(ObjectManager $manager): void
{
$timezone = 'Europe\Paris';
$container = $this->container;
$toolChain = $container->get(ToolChain::class);
$toolChain->createTools();
$this->toolChain->createTools();
// Defined in AccessGroupFixtures.php.
// $group = $this->getReference('GROUP_ADMIN');
@ -55,9 +57,7 @@ class AccessUserFixtures extends Fixture implements ContainerAwareInterface
$manager->persist($admin);
/** @var UserRepository $userRepo */
$userRepo = $container->get(UserRepository::class);
$userRepo->updateUser($admin);
$this->userRepository->updateUser($admin);
$anon = (new User())
->setSkipResourceNode(true)
@ -93,9 +93,9 @@ class AccessUserFixtures extends Fixture implements ContainerAwareInterface
$manager->flush();
$userRepo->addUserToResourceNode($admin->getId(), $admin->getId());
$userRepo->addUserToResourceNode($anon->getId(), $admin->getId());
$userRepo->addUserToResourceNode($fallbackUser->getId(), $admin->getId());
$this->userRepository->addUserToResourceNode($admin->getId(), $admin->getId());
$this->userRepository->addUserToResourceNode($anon->getId(), $admin->getId());
$this->userRepository->addUserToResourceNode($fallbackUser->getId(), $admin->getId());
$manager->flush();

@ -13,21 +13,24 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
class AccessUserUrlFixtures extends Fixture implements ContainerAwareInterface
{
private ContainerInterface $container;
public function __construct(
private TokenStorageInterface $tokenStorage,
private SettingsManager $settingsManager,
) {}
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
$this->tokenStorage = $container->get('security.token_storage');
$this->settingsManager = $container->get(SettingsManager::class);
}
public function load(ObjectManager $manager): void
{
$container = $this->container;
/** @var User $admin */
$admin = $this->getReference(AccessUserFixtures::ADMIN_USER_REFERENCE);
$anon = $this->getReference(AccessUserFixtures::ANON_USER_REFERENCE);
@ -38,7 +41,7 @@ class AccessUserUrlFixtures extends Fixture implements ContainerAwareInterface
'public',
$admin->getRoles()
);
$container->get('security.token_storage')->setToken($token);
$this->tokenStorage->setToken($token);
// retrieve the test user
// simulate $testUser being logged in
@ -61,8 +64,7 @@ class AccessUserUrlFixtures extends Fixture implements ContainerAwareInterface
$this->addReference(AccessUserFixtures::ACCESS_URL_REFERENCE, $accessUrl);
$settingsManager = $container->get(SettingsManager::class);
$settingsManager->installSchemas($accessUrl);
$this->settingsManager->installSchemas($accessUrl);
$manager->flush();
}

@ -12,14 +12,19 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class PageFixtures extends Fixture implements ContainerAwareInterface
{
private ContainerInterface $container;
public function __construct(
private CreateDefaultPages $createDefaultPages,
private TranslatorInterface $translator,
) {}
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
$this->createDefaultPages = $container->get(CreateDefaultPages::class);
$this->translator = $container->get('translator');
}
public function load(ObjectManager $manager): void
@ -28,10 +33,7 @@ class PageFixtures extends Fixture implements ContainerAwareInterface
$admin = $this->getReference(AccessUserFixtures::ADMIN_USER_REFERENCE);
$url = $this->getReference(AccessUserFixtures::ACCESS_URL_REFERENCE);
/** @var CreateDefaultPages $createDefaultPages */
$createDefaultPages = $this->container->get(CreateDefaultPages::class);
$locale = $this->container->get('translator')->getLocale();
$createDefaultPages->createDefaultPages($admin, $url, $locale);
$locale = $this->translator->getLocale();
$this->createDefaultPages->createDefaultPages($admin, $url, $locale);
}
}

@ -14,22 +14,22 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use TicketManager;
class TicketFixtures extends Fixture implements ContainerAwareInterface
{
private ContainerInterface $container;
public function __construct(
private TranslatorInterface $translator,
) {}
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
$this->translator = $container->get('translator');
}
public function load(ObjectManager $manager): void
{
$container = $this->container;
$trans = $container->get('translator');
$adminId = 1;
$ticketProject = new TicketProject();
@ -42,12 +42,12 @@ class TicketFixtures extends Fixture implements ContainerAwareInterface
$manager->flush();
$categories = [
$trans->trans('Enrollment') => $trans->trans('Tickets about enrollment'),
$trans->trans('General information') => $trans->trans('Tickets about general information'),
$trans->trans('Requests and paperwork') => $trans->trans('Tickets about requests and paperwork'),
$trans->trans('Academic Incidents') => $trans->trans('Tickets about academic incidents, like exams, practices, tasks, etc.'),
$trans->trans('Virtual campus') => $trans->trans('Tickets about virtual campus'),
$trans->trans('Online evaluation') => $trans->trans('Tickets about online evaluation'),
$this->translator->trans('Enrollment') => $this->translator->trans('Tickets about enrollment'),
$this->translator->trans('General information') => $this->translator->trans('Tickets about general information'),
$this->translator->trans('Requests and paperwork') => $this->translator->trans('Tickets about requests and paperwork'),
$this->translator->trans('Academic Incidents') => $this->translator->trans('Tickets about academic incidents, like exams, practices, tasks, etc.'),
$this->translator->trans('Virtual campus') => $this->translator->trans('Tickets about virtual campus'),
$this->translator->trans('Online evaluation') => $this->translator->trans('Tickets about online evaluation'),
];
$i = 1;
@ -70,9 +70,9 @@ class TicketFixtures extends Fixture implements ContainerAwareInterface
// Default Priorities
$defaultPriorities = [
TicketManager::PRIORITY_NORMAL => $trans->trans('Normal'),
TicketManager::PRIORITY_HIGH => $trans->trans('High'),
TicketManager::PRIORITY_LOW => $trans->trans('Low'),
TicketManager::PRIORITY_NORMAL => $this->translator->trans('Normal'),
TicketManager::PRIORITY_HIGH => $this->translator->trans('High'),
TicketManager::PRIORITY_LOW => $this->translator->trans('Low'),
];
foreach ($defaultPriorities as $code => $priority) {
@ -90,11 +90,11 @@ class TicketFixtures extends Fixture implements ContainerAwareInterface
// Default status
$defaultStatus = [
TicketManager::STATUS_NEW => $trans->trans('New'),
TicketManager::STATUS_PENDING => $trans->trans('Pending'),
TicketManager::STATUS_UNCONFIRMED => $trans->trans('Unconfirmed'),
TicketManager::STATUS_CLOSE => $trans->trans('Close'),
TicketManager::STATUS_FORWARDED => $trans->trans('Forwarded'),
TicketManager::STATUS_NEW => $this->translator->trans('New'),
TicketManager::STATUS_PENDING => $this->translator->trans('Pending'),
TicketManager::STATUS_UNCONFIRMED => $this->translator->trans('Unconfirmed'),
TicketManager::STATUS_CLOSE => $this->translator->trans('Close'),
TicketManager::STATUS_FORWARDED => $this->translator->trans('Forwarded'),
];
foreach ($defaultStatus as $code => $status) {

@ -8,9 +8,10 @@ namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Entity\Asset;
use Chamilo\CoreBundle\Repository\AssetRepository;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Vich\UploaderBundle\Event\Event;
class AssetListener
class AssetListener implements EventSubscriberInterface
{
protected AssetRepository $assetRepository;
@ -35,4 +36,12 @@ class AssetListener
}*/
}
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return ['vich_uploader.post_remove' => 'onVichUploaderPostRemove'];
}
}

@ -9,6 +9,7 @@ namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Entity\TrackECourseAccess;
use Chamilo\CourseBundle\Event\CourseAccess;
use Doctrine\ORM\EntityManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@ -16,7 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
* In and outs of a course
* This listeners is always called when user enters the course home.
*/
class CourseAccessListener
class CourseAccessListener implements EventSubscriberInterface
{
protected EntityManager $em;
@ -50,4 +51,12 @@ class CourseAccessListener
$this->em->persist($access);
$this->em->flush();
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return ['chamilo_course.course.access' => 'onCourseAccessEvent'];
}
}

@ -18,11 +18,14 @@ use Chamilo\CourseBundle\Controller\CourseControllerInterface;
use Chamilo\CourseBundle\Entity\CGroup;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\User\UserInterface;
@ -33,7 +36,7 @@ use Twig\Environment;
* Class CourseListener.
* Sets the course and session objects in the controller that implements the CourseControllerInterface.
*/
class CourseListener
class CourseListener implements EventSubscriberInterface
{
use ContainerAwareTrait;
@ -42,6 +45,7 @@ class CourseListener
private readonly AuthorizationCheckerInterface $authorizationChecker,
private readonly TranslatorInterface $translator,
private readonly EntityManagerInterface $entityManager,
private TokenStorageInterface $tokenStorage,
) {}
/**
@ -294,7 +298,7 @@ class CourseListener
$sessionHandler->remove('origin');
// Remove user temp roles
$token = $this->container->get('security.token_storage')->getToken();
$token = $this->tokenStorage->getToken();
if (null !== $token) {
/** @var User $user */
$user = $token->getUser();
@ -324,4 +328,16 @@ class CourseListener
return '';
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return [
KernelEvents::REQUEST => ['onKernelRequest', 6],
KernelEvents::RESPONSE => 'onKernelResponse',
KernelEvents::CONTROLLER => 'onKernelController',
];
}
}

@ -7,15 +7,17 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Exception\NotAllowedException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Twig\Environment;
class ExceptionListener
class ExceptionListener implements EventSubscriberInterface
{
protected Environment $twig;
protected TokenStorageInterface $tokenStorage;
@ -78,4 +80,12 @@ class ExceptionListener
// sends the modified response object to the event
$event->setResponse($response);
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return [KernelEvents::EXCEPTION => 'onKernelException'];
}
}

@ -6,11 +6,13 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\KernelEvents;
final class HTTPExceptionListener
final class HTTPExceptionListener implements EventSubscriberInterface
{
public function onKernelException(ExceptionEvent $event): void
{
@ -28,4 +30,12 @@ final class HTTPExceptionListener
$event->setResponse($response);
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return [KernelEvents::EXCEPTION => 'onKernelException'];
}
}

@ -11,11 +11,14 @@ use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository;
use Chamilo\CoreBundle\Settings\SettingsManager;
use Exception;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@ -26,7 +29,7 @@ use Twig\Environment;
* Works as old global.inc.php
* Setting old php requirements so pages inside main/* could work correctly.
*/
class LegacyListener
class LegacyListener implements EventSubscriberInterface
{
use ContainerAwareTrait;
@ -36,7 +39,7 @@ class LegacyListener
private readonly AccessUrlRepository $accessUrlRepository,
private readonly RouterInterface $router,
private readonly ParameterBagInterface $parameterBag,
private readonly SettingsManager $settingsManager
private readonly SettingsManager $settingsManager,
) {}
public function onKernelRequest(RequestEvent $event): void
@ -54,11 +57,9 @@ class LegacyListener
// Fixes the router when loading in legacy mode (public/main)
if (!empty($baseUrl)) {
// We are inside main/
/** @var RouterInterface $router */
$router = $container->get('router');
$context = $router->getContext();
$context = $this->router->getContext();
$context->setBaseUrl('');
$router->setContext($context);
$this->router->setContext($context);
}
// Setting container
@ -165,4 +166,16 @@ class LegacyListener
public function onKernelResponse(ResponseEvent $event): void {}
public function onKernelController(ControllerEvent $event): void {}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return [
KernelEvents::REQUEST => ['onKernelRequest', 7],
KernelEvents::RESPONSE => 'onKernelResponse',
KernelEvents::CONTROLLER => 'onKernelController',
];
}
}

@ -17,6 +17,7 @@ use Chamilo\CoreBundle\ServiceHelper\LoginAttemptLogger;
use Chamilo\CoreBundle\Settings\SettingsManager;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@ -24,7 +25,7 @@ use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use UserManager;
// class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
class LoginSuccessHandler
class LoginSuccessHandler implements EventSubscriberInterface
{
protected UrlGeneratorInterface $router;
protected AuthorizationCheckerInterface $checker;
@ -178,4 +179,12 @@ class LoginSuccessHandler
return $response;
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return ['security.interactive_login' => 'onSecurityInteractiveLogin'];
}
}

@ -12,13 +12,15 @@ use Chamilo\CoreBundle\Entity\User;
use DateTime;
use DateTimeZone;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Http\Event\LogoutEvent;
class LogoutListener
class LogoutListener implements EventSubscriberInterface
{
protected UrlGeneratorInterface $router;
protected AuthorizationCheckerInterface $checker;
@ -38,9 +40,9 @@ class LogoutListener
}
/**
* @return null|RedirectResponse
* @throws Exception
*/
public function onSymfonyComponentSecurityHttpEventLogoutEvent(LogoutEvent $event)
public function onSymfonyComponentSecurityHttpEventLogoutEvent(LogoutEvent $event): ?RedirectResponse
{
$request = $event->getRequest();
@ -76,4 +78,12 @@ class LogoutListener
return new RedirectResponse($login);
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return [LogoutEvent::class => ['onSymfonyComponentSecurityHttpEventLogoutEvent', 20]];
}
}

@ -9,10 +9,11 @@ namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Entity\TrackECourseAccess;
use Chamilo\CourseBundle\Event\SessionAccess;
use Doctrine\ORM\EntityManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class SessionAccessListener
class SessionAccessListener implements EventSubscriberInterface
{
protected EntityManager $em;
@ -46,4 +47,12 @@ class SessionAccessListener
$this->em->persist($access);
$this->em->flush();
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return ['chamilo_course.course.session' => 'onSessionAccessEvent'];
}
}

@ -7,9 +7,10 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\EventListener;
use Sylius\Bundle\SettingsBundle\Event\SettingsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
class SettingListener
class SettingListener implements EventSubscriberInterface
{
public function __construct() {}
@ -24,4 +25,12 @@ class SettingListener
// $settings->setAccessUrl($url);
// $event->setArgument('url', $url);
}
/**
* @return array<string, mixed>
*/
public static function getSubscribedEvents(): array
{
return ['sylius.settings.pre_save' => 'onSettingPreSave'];
}
}

@ -9,7 +9,8 @@ namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Repository\ColorThemeRepository;
use Chamilo\CoreBundle\Repository\LanguageRepository;
use Chamilo\CoreBundle\Settings\SettingsManager;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface;
@ -20,7 +21,7 @@ use Twig\Environment;
/**
* Twig-related event listener. For filters, look into ChamiloExtension.php.
*/
class TwigListener
class TwigListener implements EventSubscriberInterface
{
private SerializerInterface $serializer;
private Environment $twig;
@ -44,7 +45,7 @@ class TwigListener
$this->languageRepository = $languageRepository;
}
public function __invoke(RequestEvent $event): void
public function onControllerEvent(ControllerEvent $event): void
{
$request = $event->getRequest();
$token = $this->tokenStorage->getToken();
@ -121,4 +122,9 @@ class TwigListener
$this->twig->addGlobal('color_theme_link', $link);
}
public static function getSubscribedEvents(): array
{
return [ControllerEvent::class => 'onControllerEvent'];
}
}

@ -91,7 +91,7 @@ class AnonymousUserSubscriber implements EventSubscriberInterface
}
}
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
KernelEvents::REQUEST => 'onKernelRequest',

@ -13,6 +13,7 @@ use Sonata\Exporter\Writer\CsvWriter;
use Sonata\Exporter\Writer\JsonWriter;
use Sonata\Exporter\Writer\XlsWriter;
use Sonata\Exporter\Writer\XmlWriter;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
class Exporter
@ -58,7 +59,7 @@ class Exporter
$handler->export();
};
return new StreamedResponse($callback, 200, [
return new StreamedResponse($callback, Response::HTTP_OK, [
'Content-Type' => $contentType,
'Content-Disposition' => sprintf('attachment; filename=%s', $filename),
]);

@ -33,7 +33,7 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con
public const BATCH_SIZE = 20;
private ?EntityManager $manager = null;
private ?ContainerInterface $container = null;
protected ?ContainerInterface $container = null;
public function setEntityManager(EntityManager $manager): void
{
@ -45,10 +45,7 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con
$this->container = $container;
}
/**
* @return ContainerInterface
*/
public function getContainer()
public function getContainer(): ?ContainerInterface
{
return $this->container;
}
@ -79,12 +76,9 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con
return $admin->getUser();
}
/**
* @return EntityManager
*/
public function getEntityManager()
public function getEntityManager(): EntityManager
{
return $this->getContainer()->get('doctrine')->getManager();
return $this->container->get('doctrine')->getManager();
}
/**

@ -21,7 +21,7 @@ class Version20170625122900 extends AbstractMigrationChamilo
{
// Install tools.
$container = $this->getContainer();
$toolChain = $container->get(ToolChain::class);
$toolChain = $this->getContainer()->get(ToolChain::class);
$toolChain->createTools();
$table = $schema->getTable('c_document');

@ -9,8 +9,6 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Asset;
use Chamilo\CoreBundle\Entity\CourseCategory;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\CourseCategoryRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -133,13 +131,10 @@ class Version20191101132000 extends AbstractMigrationChamilo
$this->addSql('CREATE INDEX IDX_AFF874975DA1941 ON course_category (asset_id);');
}
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$repo = $container->get(CourseCategoryRepository::class);
$repo = $this->getEntityManager()->getRepository(CourseCategory::class);
if ($table->hasColumn('image')) {
foreach ($all as $category) {

@ -22,11 +22,10 @@ class Version20191206150030 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$doctrine = $this->getContainer()->get('doctrine');
$em = $this->getEntityManager();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$batchSize = self::BATCH_SIZE;

@ -21,9 +21,8 @@ final class Version20201010224040 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$doctrine = $this->getContainer()->get('doctrine');
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
@ -32,7 +31,7 @@ final class Version20201010224040 extends AbstractMigrationChamilo
$result = $connection->executeQuery($sql);
$items = $result->fetchAllAssociative();
$repo = $container->get(SysAnnouncementRepository::class);
$repo = $this->getContainer()->get(SysAnnouncementRepository::class);
foreach ($items as $itemData) {
$id = $itemData['id'];

@ -23,12 +23,10 @@ final class Version20201212114910 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
$urlRepo = $container->get(AccessUrlRepository::class);
$userRepo = $container->get(UserRepository::class);
$urlRepo = $this->container->get(AccessUrlRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$userList = [];
// Adding first admin as main creator also adding to the resource node tree.

@ -11,7 +11,10 @@ use Chamilo\CoreBundle\Entity\AccessUrlRelCourse;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
@ -28,15 +31,14 @@ final class Version20201212195011 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
$connection = $em->getConnection();
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$toolRepo = $container->get(CToolRepository::class);
$urlRepo = $em->getRepository(AccessUrl::class);
$userRepo = $container->get(UserRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
$toolRepo = $this->container->get(CToolRepository::class);
$urlRepo = $this->container->get(AccessUrlRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$batchSize = self::BATCH_SIZE;
$admin = $this->getAdmin();

@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
@ -15,7 +16,6 @@ use Chamilo\CourseBundle\Entity\CGroup;
use Chamilo\CourseBundle\Entity\CGroupCategory;
use Chamilo\CourseBundle\Repository\CGroupCategoryRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201212195112 extends AbstractMigrationChamilo
@ -27,16 +27,13 @@ final class Version20201212195112 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$groupCategoryRepo = $container->get(CGroupCategoryRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
$groupRepo = $this->container->get(CGroupRepository::class);
$groupCategoryRepo = $this->container->get(CGroupCategoryRepository::class);
$batchSize = self::BATCH_SIZE;

@ -15,10 +15,7 @@ use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Repository\CDocumentRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\EntityManager;
use Symfony\Component\HttpFoundation\File\UploadedFile;
final class Version20201212203625 extends AbstractMigrationChamilo
@ -30,22 +27,15 @@ final class Version20201212203625 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $this->getEntityManager();
/** @var EntityManager $em */
$em = $doctrine->getManager();
/** @var Connection $connection */
$connection = $em->getConnection();
/** @var CDocumentRepository $documentRepo */
$documentRepo = $container->get(CDocumentRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$documentRepo = $this->container->get(CDocumentRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$attemptRepo = $em->getRepository(TrackEAttempt::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$batchSize = self::BATCH_SIZE;

@ -14,8 +14,6 @@ use Chamilo\CourseBundle\Entity\CCalendarEvent;
use Chamilo\CourseBundle\Entity\CCalendarEventAttachment;
use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository;
use Chamilo\CourseBundle\Repository\CCalendarEventRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\EntityManagerInterface;
@ -28,19 +26,15 @@ final class Version20201215072918 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$eventRepo = $container->get(CCalendarEventRepository::class);
$eventAttachmentRepo = $container->get(CCalendarEventAttachmentRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$eventRepo = $this->container->get(CCalendarEventRepository::class);
$eventAttachmentRepo = $this->container->get(CCalendarEventAttachmentRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$admin = $this->getAdmin();
$oldNewEventMap = [];

@ -9,12 +9,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CCourseDescription;
use Chamilo\CourseBundle\Repository\CCourseDescriptionRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201215135838 extends AbstractMigrationChamilo
@ -26,18 +22,12 @@ final class Version20201215135838 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$courseDescriptionRepo = $container->get(CCourseDescriptionRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$courseDescriptionRepo = $this->container->get(CCourseDescriptionRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -13,7 +13,6 @@ use Chamilo\CourseBundle\Entity\CLink;
use Chamilo\CourseBundle\Entity\CLinkCategory;
use Chamilo\CourseBundle\Repository\CLinkCategoryRepository;
use Chamilo\CourseBundle\Repository\CLinkRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201215141131 extends AbstractMigrationChamilo
@ -25,16 +24,13 @@ final class Version20201215141131 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$linkRepo = $container->get(CLinkRepository::class);
$linkCategoryRepo = $container->get(CLinkCategoryRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$linkRepo = $this->container->get(CLinkRepository::class);
$linkCategoryRepo = $this->container->get(CLinkCategoryRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();

@ -7,20 +7,18 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CourseBundle\Entity\CQuizQuestion;
use Chamilo\CourseBundle\Entity\CQuizQuestionCategory;
use Chamilo\CourseBundle\Repository\CDocumentRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository;
use Chamilo\CourseBundle\Repository\CQuizQuestionRepository;
use Chamilo\CourseBundle\Repository\CQuizRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201215142610 extends AbstractMigrationChamilo
@ -32,24 +30,16 @@ final class Version20201215142610 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$quizRepo = $container->get(CQuizRepository::class);
$quizQuestionRepo = $container->get(CQuizQuestionRepository::class);
$quizQuestionCategoryRepo = $container->get(CQuizQuestionCategoryRepository::class);
$documentRepo = $container->get(CDocumentRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$admin = $this->getAdmin();
$quizRepo = $this->container->get(CQuizRepository::class);
$quizQuestionRepo = $this->container->get(CQuizQuestionRepository::class);
$quizQuestionCategoryRepo = $this->container->get(CQuizQuestionCategoryRepository::class);
$documentRepo = $this->container->get(CDocumentRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -9,15 +9,11 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CAnnouncement;
use Chamilo\CourseBundle\Entity\CAnnouncementAttachment;
use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository;
use Chamilo\CourseBundle\Repository\CAnnouncementRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201215153517 extends AbstractMigrationChamilo
@ -29,22 +25,15 @@ final class Version20201215153517 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$announcementRepo = $container->get(CAnnouncementRepository::class);
$announcementAttachmentRepo = $container->get(CAnnouncementAttachmentRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$announcementRepo = $this->container->get(CAnnouncementRepository::class);
$announcementAttachmentRepo = $this->container->get(CAnnouncementAttachmentRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$admin = $this->getAdmin();

@ -9,20 +9,15 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumCategory;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CourseBundle\Repository\CForumAttachmentRepository;
use Chamilo\CourseBundle\Repository\CForumCategoryRepository;
use Chamilo\CourseBundle\Repository\CForumPostRepository;
use Chamilo\CourseBundle\Repository\CForumRepository;
use Chamilo\CourseBundle\Repository\CForumThreadRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201215160445 extends AbstractMigrationChamilo
@ -34,26 +29,18 @@ final class Version20201215160445 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$forumCategoryRepo = $container->get(CForumCategoryRepository::class);
$forumRepo = $container->get(CForumRepository::class);
$forumAttachmentRepo = $container->get(CForumAttachmentRepository::class);
$forumThreadRepo = $container->get(CForumThreadRepository::class);
$forumPostRepo = $container->get(CForumPostRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$forumCategoryRepo = $this->container->get(CForumCategoryRepository::class);
$forumRepo = $this->container->get(CForumRepository::class);
$forumThreadRepo = $this->container->get(CForumThreadRepository::class);
$forumPostRepo = $this->container->get(CForumPostRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');
@ -275,7 +262,6 @@ final class Version20201215160445 extends AbstractMigrationChamilo
$result = $connection->executeQuery($sql);
$items = $result->fetchAllAssociative();
$forumPostRepo = $container->get(CForumPostRepository::class);
foreach ($items as $itemData) {
$id = $itemData['iid'];
$postId = (int) $itemData['post_id'];

@ -9,17 +9,10 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CThematic;
use Chamilo\CourseBundle\Entity\CThematicAdvance;
use Chamilo\CourseBundle\Entity\CThematicPlan;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\CourseBundle\Repository\CThematicAdvanceRepository;
use Chamilo\CourseBundle\Repository\CThematicPlanRepository;
use Chamilo\CourseBundle\Repository\CThematicRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201216105331 extends AbstractMigrationChamilo
@ -31,24 +24,13 @@ final class Version20201216105331 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$thematicRepo = $container->get(CThematicRepository::class);
$thematicAdvanceRepo = $container->get(CThematicAdvanceRepository::class);
$thematicPlanRepo = $container->get(CThematicPlanRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
$thematicRepo = $this->container->get(CThematicRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -9,14 +9,9 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CAttendance;
use Chamilo\CourseBundle\Entity\CAttendanceCalendar;
use Chamilo\CourseBundle\Repository\CAttendanceRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201216110722 extends AbstractMigrationChamilo
@ -28,23 +23,14 @@ final class Version20201216110722 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$attendanceRepo = $container->get(CAttendanceRepository::class);
$attendanceRepo = $this->container->get(CAttendanceRepository::class);
// $attendanceRepo = $container->get(CAttendanceCalendar::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -9,12 +9,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CGlossary;
use Chamilo\CourseBundle\Repository\CGlossaryRepository;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201216120654 extends AbstractMigrationChamilo
@ -26,18 +22,12 @@ final class Version20201216120654 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$glossaryRepo = $container->get(CGlossaryRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$glossaryRepo = $this->container->get(CGlossaryRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();

@ -15,7 +15,6 @@ use Chamilo\CourseBundle\Entity\CLpItem;
use Chamilo\CourseBundle\Repository\CLpCategoryRepository;
use Chamilo\CourseBundle\Repository\CLpItemRepository;
use Chamilo\CourseBundle\Repository\CLpRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201216122012 extends AbstractMigrationChamilo
@ -27,17 +26,14 @@ final class Version20201216122012 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$lpCategoryRepo = $container->get(CLpCategoryRepository::class);
$lpRepo = $container->get(CLpRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$lpItemRepo = $container->get(CLpItemRepository::class);
$lpCategoryRepo = $this->container->get(CLpCategoryRepository::class);
$lpRepo = $this->container->get(CLpRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$lpItemRepo = $this->container->get(CLpItemRepository::class);
$batchSize = self::BATCH_SIZE;
$admin = $this->getAdmin();

@ -8,8 +8,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpItem;
use Chamilo\CourseBundle\Repository\CLpItemRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use learnpath;
use stdClass;
@ -23,14 +23,11 @@ final class Version20201216132000 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$lpItemRepo = $container->get(CLpItemRepository::class);
$lpItemRepo = $this->container->get(CLpItemRepository::class);
$batchSize = self::BATCH_SIZE;
// $q = $em->createQuery('SELECT lp FROM Chamilo\CourseBundle\Entity\CLp lp WHERE lp.iid = 263 ORDER BY lp.iid');

@ -8,10 +8,12 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CGroup;
use Chamilo\CourseBundle\Entity\CStudentPublication;
use Chamilo\CourseBundle\Entity\CStudentPublicationComment;
use Chamilo\CourseBundle\Entity\CStudentPublicationCorrection;
@ -20,7 +22,6 @@ use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository;
use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository;
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201217124011 extends AbstractMigrationChamilo
@ -32,24 +33,20 @@ final class Version20201217124011 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$studentPublicationRepo = $container->get(CStudentPublicationRepository::class);
$studentPublicationCommentRepo = $container->get(CStudentPublicationCommentRepository::class);
$studentPublicationCorrectionRepo = $container->get(CStudentPublicationCorrectionRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$studentPublicationRepo = $this->container->get(CStudentPublicationRepository::class);
$studentPublicationCommentRepo = $this->container->get(CStudentPublicationCommentRepository::class);
$studentPublicationCorrectionRepo = $this->container->get(CStudentPublicationCorrectionRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
$groupRepo = $this->container->get(CGroupRepository::class);
// $userRepo = $container->get(UserRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$admin = $this->getAdmin();

@ -9,12 +9,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CSurvey;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\CourseBundle\Repository\CSurveyRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201218132719 extends AbstractMigrationChamilo
@ -26,18 +22,12 @@ final class Version20201218132719 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$surveyRepo = $container->get(CSurveyRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
$surveyRepo = $this->container->get(CSurveyRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -9,13 +9,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CWiki;
use Chamilo\CourseBundle\Repository\CGroupRepository;
use Chamilo\CourseBundle\Repository\CWikiRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20201219115244 extends AbstractMigrationChamilo
@ -27,22 +22,12 @@ final class Version20201219115244 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$wikiRepo = $container->get(CWikiRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$groupRepo = $container->get(CGroupRepository::class);
$userRepo = $container->get(UserRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
$wikiRepo = $this->container->get(CWikiRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$admin = $this->getAdmin();

@ -6,13 +6,13 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\AccessUrlRelUserGroup;
use Chamilo\CoreBundle\Entity\Illustration;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Entity\Usergroup;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository;
use Chamilo\CoreBundle\Repository\Node\IllustrationRepository;
use Chamilo\CoreBundle\Repository\Node\UsergroupRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -25,16 +25,14 @@ final class Version20210205082253 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$illustrationRepo = $container->get(IllustrationRepository::class);
$illustrationRepo = $this->container->get(IllustrationRepository::class);
// Adding users to the resource node tree.
$batchSize = self::BATCH_SIZE;
@ -82,8 +80,9 @@ final class Version20210205082253 extends AbstractMigrationChamilo
$q = $em->createQuery('SELECT u FROM Chamilo\CoreBundle\Entity\Usergroup u');
$admin = $this->getAdmin();
$userGroupRepo = $container->get(UsergroupRepository::class);
$urlRepo = $container->get(AccessUrlRepository::class);
$userGroupRepo = $this->container->get(UsergroupRepository::class);
$urlRepo = $this->container->get(AccessUrlRepository::class);
$urlList = $urlRepo->findAll();
/** @var AccessUrl $url */

@ -8,9 +8,9 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Repository\CLpRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
class Version20210221082033 extends AbstractMigrationChamilo
@ -22,18 +22,14 @@ class Version20210221082033 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$lpRepo = $container->get(CLpRepository::class);
$lpRepo = $this->container->get(CLpRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -23,14 +23,11 @@ class Version20210813150011 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
// $connection = $em->getConnection();
// $skillRepo = $container->get(SkillRepository::class);

@ -7,6 +7,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Illustration;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\IllustrationRepository;
use Chamilo\Kernel;
@ -23,12 +24,11 @@ final class Version20210923090920 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$em = $this->getEntityManager();
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$illustrationRepo = $container->get(IllustrationRepository::class);
$illustrationRepo = $this->container->get(IllustrationRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');
/** @var Course $course */

@ -5,6 +5,8 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\Tool;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
@ -24,16 +26,14 @@ final class Version20210930130343 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
$connection = $em->getConnection();
$introRepo = $container->get(CToolIntroRepository::class);
$cToolRepo = $container->get(CToolRepository::class);
$toolRepo = $container->get(ToolRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$introRepo = $this->container->get(CToolIntroRepository::class);
$cToolRepo = $this->container->get(CToolRepository::class);
$toolRepo = $this->container->get(ToolRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -5,11 +5,11 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\TicketMessageAttachment;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\TicketMessageAttachmentRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
class Version20211005154000 extends AbstractMigrationChamilo
@ -21,19 +21,16 @@ class Version20211005154000 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$attachmentRepo = $container->get(TicketMessageAttachmentRepository::class);
$userRepo = $container->get(UserRepository::class);
$attachmentRepo = $this->container->get(TicketMessageAttachmentRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$sql = 'SELECT * FROM ticket_message_attachments ORDER BY id';

@ -20,10 +20,10 @@ final class Version20211029123419 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
if ($schema->hasTable('page')) {
$container = $this->getContainer();
$createDefaultPages = $container->get(CreateDefaultPages::class);
$em = $this->getEntityManager();
$createDefaultPages = $this->getContainer()->get(CreateDefaultPages::class);
$urlRepo = $container->get(AccessUrlRepository::class);
$urlRepo = $this->container->get(AccessUrlRepository::class);
$urlList = $urlRepo->findAll();
/** @var AccessUrl $url */

@ -25,13 +25,10 @@ class Version20230204150030 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
/** @var EntityManager $em */
$em = $doctrine->getManager();
$em = $this->getEntityManager();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$batchSize = self::BATCH_SIZE;
@ -45,7 +42,7 @@ class Version20230204150030 extends AbstractMigrationChamilo
'itemType' => ExtraField::SESSION_FIELD_TYPE,
]);
$sessionRepo = $container->get(SessionRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
/** @var ExtraFieldValues $item */
foreach ($q->toIterable() as $item) {

@ -7,15 +7,15 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpRelUser;
use Chamilo\CourseBundle\Repository\CLpRelUserRepository;
use Chamilo\CourseBundle\Repository\CLpRepository;
use Chamilo\Kernel;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20230215072918 extends AbstractMigrationChamilo
@ -27,26 +27,14 @@ final class Version20230215072918 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$lpRepo = $container->get(CLpRepository::class);
/** @var CLpRelUserRepository $cLpRelUserRepo */
$cLpRelUserRepo = $container->get(CLpRelUserRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$sessionRepo = $container->get(SessionRepository::class);
$userRepo = $container->get(UserRepository::class);
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
$admin = $this->getAdmin();
$lpRepo = $this->container->get(CLpRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$sessionRepo = $this->container->get(SessionRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\DataFixtures\SettingsCurrentFixtures;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\Kernel;
use Doctrine\DBAL\Schema\Schema;
use const JSON_UNESCAPED_SLASHES;
@ -376,7 +377,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
{
global $_configuration;
$container = $this->getContainer();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$oldConfigPath = $rootPath.'/app/config/configuration.php';
$configFileLoaded = \in_array($oldConfigPath, get_included_files(), true);

@ -20,10 +20,8 @@ final class Version20230315115019 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$em = $this->getEntityManager();

@ -9,6 +9,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\TrackEAttemptQualify;
use Chamilo\CoreBundle\Entity\TrackEExercise;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\DBAL\Schema\Schema;
class Version20230321164019 extends AbstractMigrationChamilo
@ -20,9 +21,7 @@ class Version20230321164019 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
$sql = 'SELECT * FROM track_e_attempt_recording';
$connection = $this->getEntityManager()->getConnection();

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Repository\CLpRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20230615213500 extends AbstractMigrationChamilo
@ -22,14 +21,11 @@ final class Version20230615213500 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$lpRepo = $container->get(CLpRepository::class);
$lpRepo = $this->container->get(CLpRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -23,10 +23,9 @@ final class Version20230720143000 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$q = $em->createQuery('SELECT u FROM Chamilo\CoreBundle\Entity\User u');

@ -6,11 +6,12 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\PersonalFile;
use Chamilo\CoreBundle\Entity\SocialPost;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\PersonalFileRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20230720222140 extends AbstractMigrationChamilo
@ -22,19 +23,13 @@ final class Version20230720222140 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$userRepo = $container->get(UserRepository::class);
/** @var PersonalFileRepository $personalRepo */
$personalRepo = $container->get(PersonalFileRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$personalRepo = $this->container->get(PersonalFileRepository::class);
$q = $em->createQuery('SELECT s FROM Chamilo\CoreBundle\Entity\SocialPost s');

@ -9,6 +9,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\AgendaReminder;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CourseBundle\Entity\CCalendarEvent;
use DateTime;
use DateTimeZone;
@ -41,7 +42,7 @@ class Version20230904173400 extends AbstractMigrationChamilo
$map = [];
$em = $this->getEntityManager();
$userRepo = $em->getRepository(User::class);
$userRepo = $this->container->get(UserRepository::class);
$personalAgendas = $this->getPersonalEvents();

@ -8,8 +8,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Repository\CDocumentRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20230913162700 extends AbstractMigrationChamilo
@ -21,16 +21,11 @@ final class Version20230913162700 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
/** @var CDocumentRepository $documentRepo */
$documentRepo = $container->get(CDocumentRepository::class);
$documentRepo = $this->container->get(CDocumentRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -7,12 +7,12 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CourseBundle\Repository\CQuizRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Exception;
@ -25,16 +25,13 @@ final class Version20231012185600 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$quizRepo = $container->get(CQuizRepository::class);
$courseRepo = $container->get(CourseRepository::class);
$userRepo = $container->get(UserRepository::class);
$quizRepo = $this->container->get(CQuizRepository::class);
$courseRepo = $this->container->get(CourseRepository::class);
$userRepo = $this->container->get(UserRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -8,8 +8,6 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Repository\CDocumentRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use const PREG_NO_ERROR;
@ -23,23 +21,15 @@ final class Version20231022124700 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
/** @var CDocumentRepository $documentRepo */
$documentRepo = $container->get(CDocumentRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');
/** @var Course $course */
foreach ($q->toIterable() as $course) {
$courseId = $course->getId();
$courseDirectory = $course->getDirectory();
// Tool intro
$sql = "SELECT * FROM c_tool_intro WHERE c_id = {$courseId} ORDER BY iid";

@ -10,11 +10,10 @@ use Chamilo\CoreBundle\Entity\SocialPost;
use Chamilo\CoreBundle\Entity\SocialPostAttachment;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\Node\SocialPostAttachmentRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\Repository\SocialPostRepository;
use DateTime;
use DateTimeZone;
use DirectoryIterator;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -27,18 +26,13 @@ final class Version20231026231100 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$repo = $container->get(SocialPostAttachmentRepository::class);
$userRepo = $container->get(UserRepository::class);
$admin = $this->getAdmin();
$repo = $this->container->get(SocialPostAttachmentRepository::class);
$socialPostRepo = $this->container->get(SocialPostRepository::class);
$sub = $em->createQueryBuilder();
$sub->select('sp.id')
@ -70,7 +64,7 @@ final class Version20231026231100 extends AbstractMigrationChamilo
$mimeType = mime_content_type($foundFilePath);
$uploadFile = new UploadedFile($foundFilePath, $filename, $mimeType, null, true);
$socialPost = $em->getRepository(SocialPost::class)->find($messageId);
$socialPost = $socialPostRepo->find($messageId);
$attachment = new SocialPostAttachment();
$attachment->setSocialPost($socialPost);

@ -19,11 +19,7 @@ final class Version20231110194300 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$customThemesFolders = [

@ -7,9 +7,9 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\SettingsCurrentRepository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
final class Version20240112103400 extends AbstractMigrationChamilo
@ -21,15 +21,9 @@ final class Version20240112103400 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$kernel = $container->get('kernel');
$rootPath = $kernel->getProjectDir();
$settingRepo = $container->get(SettingsCurrentRepository::class);
$settingRepo = $this->container->get(SettingsCurrentRepository::class);
$q = $em->createQuery('SELECT c FROM Chamilo\CoreBundle\Entity\Course c');

@ -8,6 +8,11 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\AbstractResource;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CAnnouncement;
use Chamilo\CourseBundle\Entity\CGlossary;
use Chamilo\CourseBundle\Entity\CGroupCategory;
use Chamilo\CourseBundle\Entity\CLink;
use Chamilo\CourseBundle\Entity\CLinkCategory;
use Chamilo\CourseBundle\Repository\CAnnouncementRepository;
use Chamilo\CourseBundle\Repository\CGlossaryRepository;
use Chamilo\CourseBundle\Repository\CGroupCategoryRepository;
@ -25,18 +30,14 @@ final class Version20240112191200 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
$linkCategoryRepo = $this->container->get(CLinkCategoryRepository::class);
$linkRepo = $this->container->get(CLinkRepository::class);
$groupCategoryRepo = $this->container->get(CGroupCategoryRepository::class);
$glossaryRepo = $this->container->get(CGlossaryRepository::class);
$announcementRepo = $this->container->get(CAnnouncementRepository::class);
$linkCategoryRepo = $container->get(CLinkCategoryRepository::class);
$linkRepo = $container->get(CLinkRepository::class);
$groupCategoryRepo = $container->get(CGroupCategoryRepository::class);
$glossaryRepo = $container->get(CGlossaryRepository::class);
$announcementRepo = $container->get(CAnnouncementRepository::class);
$this->updateResourceNodeDisplayOrder($linkCategoryRepo, 'c_link_category', $em, $schema);
$this->updateResourceNodeDisplayOrder($linkRepo, 'c_link', $em, $schema);

@ -22,11 +22,8 @@ final class Version20240122221400 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
/** @var Connection $connection */
$connection = $em->getConnection();
// Default sublanguages to be excluded from the update.
@ -87,8 +84,7 @@ final class Version20240122221400 extends AbstractMigrationChamilo
private function generatePoFileFromTrad4All(string $englishName, string $isocode): void
{
$container = $this->getContainer();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$langPath = $rootPath.'/var/translations/import/'.$englishName.'/trad4all.inc.php';
@ -188,8 +184,7 @@ final class Version20240122221400 extends AbstractMigrationChamilo
private function deleteImportFolder(): void
{
$container = $this->getContainer();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$importPath = $rootPath.'/var/translations/import/';

@ -7,6 +7,8 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\GradebookCertificate;
use Chamilo\CoreBundle\Entity\PersonalFile;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CoreBundle\Repository\GradebookCertificateRepository;
use Chamilo\CoreBundle\Repository\Node\PersonalFileRepository;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -19,14 +21,16 @@ final class Version20240128205500 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$em = $this->getEntityManager();
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$q = $em->createQuery('SELECT u FROM Chamilo\CoreBundle\Entity\User u');
$gradebookCertificateRepo = $this->container->get(GradebookCertificateRepository::class);
$personalRepo = $this->container->get(PersonalFileRepository::class);
foreach ($q->toIterable() as $userEntity) {
$id = $userEntity->getId();
$path = 'users/'.substr((string) $id, 0, 1).'/'.$id.'/';
@ -47,7 +51,7 @@ final class Version20240128205500 extends AbstractMigrationChamilo
$originalTitle = basename($file);
// Search in gradebook_certificate for a record with a path_certificate that matches $originalTitle
$certificate = $em->getRepository(GradebookCertificate::class)->findOneBy(['pathCertificate' => '/'.$originalTitle]);
$certificate = $gradebookCertificateRepo->findOneBy(['pathCertificate' => '/'.$originalTitle]);
if (!$certificate) {
// If not found, continue with the next file
continue;
@ -56,7 +60,7 @@ final class Version20240128205500 extends AbstractMigrationChamilo
$catId = null !== $certificate->getCategory() ? $certificate->getCategory()->getId() : 0;
$newTitle = hash('sha256', $id.$catId).'.html';
$existingFile = $em->getRepository(PersonalFile::class)->findOneBy(['title' => $newTitle]);
$existingFile = $personalRepo->findOneBy(['title' => $newTitle]);
if ($existingFile) {
error_log('MIGRATIONS :: Skipping file -- '.$file.' (Already exists)');

@ -9,7 +9,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\Asset;
use Chamilo\CoreBundle\Entity\Templates;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\Kernel;
use Chamilo\CoreBundle\Repository\TemplatesRepository;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@ -22,16 +22,14 @@ class Version20240130161800 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
/** @var Kernel $kernel */
$kernel = $container->get('kernel');
$kernel = $this->getContainer()->get('kernel');
$rootPath = $kernel->getProjectDir();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
$connection = $em->getConnection();
$templatesRepo = $this->container->get(TemplatesRepository::class);
$sql = 'SELECT id, image, c_id FROM templates WHERE image IS NOT NULL';
$stmt = $connection->prepare($sql);
$result = $stmt->executeQuery();
@ -64,7 +62,7 @@ class Version20240130161800 extends AbstractMigrationChamilo
$em->persist($asset);
$em->flush();
$template = $em->getRepository(Templates::class)->find($templateId);
$template = $templatesRepo->find($templateId);
if ($template) {
$template->setImage($asset);
$em->persist($template);

@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CLink;
use Chamilo\CourseBundle\Entity\CShortcut;
use Chamilo\CourseBundle\Repository\CLinkRepository;
use Chamilo\CourseBundle\Repository\CShortcutRepository;
use Doctrine\DBAL\Schema\Schema;
@ -22,16 +23,13 @@ class Version20240202122300 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $doctrine->getManager();
$em = $this->getEntityManager();
$connection = $em->getConnection();
$admin = $this->getAdmin();
$linkRepo = $container->get(CLinkRepository::class);
$shortcutRepo = $container->get(CShortcutRepository::class);
$linkRepo = $this->container->get(CLinkRepository::class);
$shortcutRepo = $this->container->get(CShortcutRepository::class);
$sql = 'SELECT * FROM c_link WHERE on_homepage = 1';
$stmt = $connection->prepare($sql);

@ -22,13 +22,9 @@ class Version20240310160200 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$container = $this->getContainer();
$doctrine = $container->get('doctrine');
$em = $this->getEntityManager();
$em = $doctrine->getManager();
/** @var UserRepository $repo */
$repo = $container->get(UserRepository::class);
$repo = $this->container->get(UserRepository::class);
$plainPassword = 'fallback_user';
$encodedPassword = password_hash($plainPassword, PASSWORD_DEFAULT);

@ -8,7 +8,7 @@ namespace Chamilo\LtiBundle\Component;
use Doctrine\ORM\EntityManager;
use SimpleXMLElement;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Contracts\Translation\TranslatorInterface;
abstract class OutcomeRequest
{
@ -23,7 +23,7 @@ abstract class OutcomeRequest
protected array $responseBodyParam;
protected EntityManager $entityManager;
protected Translator $translator;
protected TranslatorInterface $translator;
public function __construct(SimpleXMLElement $xml)
{
@ -38,7 +38,7 @@ abstract class OutcomeRequest
$this->entityManager = $entityManager;
}
public function setTranslator(Translator $translator): void
public function setTranslator(TranslatorInterface $translator): void
{
$this->translator = $translator;
}

@ -11,6 +11,7 @@ use Chamilo\CoreBundle\Traits\ControllerTrait;
use Chamilo\LtiBundle\Entity\ExternalTool;
use Chamilo\LtiBundle\Form\ExternalToolType;
use Chamilo\LtiBundle\Repository\ExternalToolRepository;
use Doctrine\Persistence\ManagerRegistry;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -19,30 +20,29 @@ use Symfony\Component\Routing\Annotation\Route;
/**
* Class AdminController.
*
* @Route("/admin/lti")
*
* @Security("is_granted('ROLE_ADMIN')")
*/
#[Route(path: '/admin/lti')]
class AdminController extends BaseController
{
use ControllerTrait;
public function __construct(
private ManagerRegistry $managerRegistry,
private ExternalToolRepository $externalToolRepository
) {}
/**
* @Route("/", name="chamilo_lti_admin")
*/
public function adminAction(): Response
#[Route(path: '/', name: 'chamilo_lti_admin')]
public function admin(): Response
{
$tools = $this->get(ExternalToolRepository::class)->findAll();
$tools = $this->externalToolRepository->findAll();
return $this->render('@ChamiloCore/Lti/admin.html.twig', [
'tools' => $tools,
]);
}
/**
* @Route("/add", name="chamilo_lti_admin_add")
*/
public function adminAddAction(Request $request): Response
#[Route(path: '/add', name: 'chamilo_lti_admin_add')]
public function adminAdd(Request $request): Response
{
$form = $this->createForm(ExternalToolType::class, new ExternalTool());
$form->handleRequest($request);
@ -51,7 +51,7 @@ class AdminController extends BaseController
/** @var ExternalTool $tool */
$tool = $form->getData();
$this->get(ExternalToolRepository::class)->create($tool);
$this->externalToolRepository->create($tool);
$this->addFlash('success', $this->trans('External tool added'));
@ -66,12 +66,10 @@ class AdminController extends BaseController
);
}
/**
* @Route("/edit/{toolId}", name="chamilo_lti_admin_edit", requirements={"toolId"="\d+"})
*/
public function adminEditAction(int $toolId, Request $request): Response
#[Route(path: '/edit/{toolId}', name: 'chamilo_lti_admin_edit', requirements: ['toolId' => '\d+'])]
public function adminEdit(int $toolId, Request $request): Response
{
$em = $this->getDoctrine()
$em = $this->managerRegistry
->getManager()
;
@ -108,12 +106,10 @@ class AdminController extends BaseController
);
}
/**
* @Route("/delete/{toolId}", name="chamilo_lti_admin_delete", requirements={"toolId"="\d+"})
*/
public function adminDeleteAction(int $toolId): Response
#[Route(path: '/delete/{toolId}', name: 'chamilo_lti_admin_delete', requirements: ['toolId' => '\d+'])]
public function adminDelete(int $toolId): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var ExternalTool $tool */
$tool = $em->find(ExternalTool::class, $toolId);

@ -18,6 +18,7 @@ use Chamilo\LtiBundle\Entity\ExternalTool;
use Chamilo\LtiBundle\Form\ExternalToolType;
use Chamilo\LtiBundle\Util\Utils;
use Display;
use Doctrine\Persistence\ManagerRegistry;
use EvalForm;
use Evaluation;
use Exception;
@ -32,28 +33,18 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use UserManager;
/**
* Class CourseController.
*
* @Route("/courses/{cid}/lti");
*/
#[Route(path: '/courses/{cid}/lti')] // ;
class CourseController extends ToolBaseController
{
private CShortcutRepository $shortcutRepository;
public function __construct(
private readonly CShortcutRepository $shortcutRepository,
private readonly ManagerRegistry $managerRegistry
) {}
public function __construct(CShortcutRepository $shortcutRepository)
#[Route(path: '/edit/{id}', name: 'chamilo_lti_edit', requirements: ['id' => '\d+'])]
public function edit(int $id, Request $request): Response
{
$this->shortcutRepository = $shortcutRepository;
}
/**
* @Route("/edit/{id}", name="chamilo_lti_edit", requirements={"id"="\d+"})
*
* @param string $id
*/
public function editAction($id, Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var ExternalTool $tool */
$tool = $em->find(ExternalTool::class, $id);
@ -126,12 +117,10 @@ class CourseController extends ToolBaseController
);
}
/**
* @Route("/launch/{id}", name="chamilo_lti_launch", requirements={"id"="\d+"})
*/
public function launchAction(int $id, Utils $ltiUtil): Response
#[Route(path: '/launch/{id}', name: 'chamilo_lti_launch', requirements: ['id' => '\d+'])]
public function launch(int $id, Utils $ltiUtil): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var null|ExternalTool $tool */
$tool = $em->find(ExternalTool::class, $id);
@ -286,10 +275,8 @@ class CourseController extends ToolBaseController
);
}
/**
* @Route("/item_return", name="chamilo_lti_return_item")
*/
public function returnItemAction(Request $request): Response
#[Route(path: '/item_return', name: 'chamilo_lti_return_item')]
public function returnItem(Request $request): Response
{
$contentItems = $request->get('content_items');
$data = $request->get('data');
@ -298,7 +285,7 @@ class CourseController extends ToolBaseController
throw $this->createAccessDeniedException();
}
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var ExternalTool $tool */
$tool = $em->find(ExternalTool::class, str_replace('tool:', '', $data));
@ -357,16 +344,12 @@ class CourseController extends ToolBaseController
);
}
/**
* @Route("/{id}", name="chamilo_lti_show", requirements={"id"="\d+"})
*
* @param string $id
*/
public function showAction($id): Response
#[Route(path: '/{id}', name: 'chamilo_lti_show', requirements: ['id' => '\d+'])]
public function show(int $id): Response
{
$course = $this->getCourse();
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var null|ExternalTool $externalTool */
$externalTool = $em->find(ExternalTool::class, $id);
@ -389,14 +372,13 @@ class CourseController extends ToolBaseController
}
/**
* @Route("/", name="chamilo_lti_configure")
* @Route("/add/{id}", name="chamilo_lti_configure_global", requirements={"id"="\d+"})
*
* @Security("is_granted('ROLE_TEACHER')")
*/
public function courseConfigureAction(?int $id, Request $request): Response
#[Route(path: '/', name: 'chamilo_lti_configure')]
#[Route(path: '/add/{id}', name: 'chamilo_lti_configure_global', requirements: ['id' => '\d+'])]
public function courseConfigure(?int $id, Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$repo = $em->getRepository(ExternalTool::class);
$externalTool = new ExternalTool();
@ -494,17 +476,16 @@ class CourseController extends ToolBaseController
}
/**
* @Route("/grade/{catId}", name="chamilo_lti_grade", requirements={"catId"="\d+"})
*
* @Security("is_granted('ROLE_TEACHER')")
*
* @param string $catId
*
* @throws Exception
*/
public function gradeAction($catId)
#[Route(path: '/grade/{catId}', name: 'chamilo_lti_grade', requirements: ['catId' => '\d+'])]
public function grade(int $catId): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$toolRepo = $em->getRepository(ExternalTool::class);
$course = $this->getCourse();
@ -645,10 +626,7 @@ class CourseController extends ToolBaseController
}
}
/**
* @return array
*/
private static function getReplaceableVariables(User $user, Course $course, ?Session $session = null)
private static function getReplaceableVariables(User $user, Course $course, ?Session $session = null): array
{
return [
'$User.id' => $user->getId(),
@ -787,7 +765,7 @@ class CourseController extends ToolBaseController
);
}
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$course = $newTool->getCourse();

@ -13,20 +13,25 @@ use Chamilo\LtiBundle\Component\OutcomeReplaceRequest;
use Chamilo\LtiBundle\Component\OutcomeResponse;
use Chamilo\LtiBundle\Component\OutcomeUnsupportedRequest;
use Chamilo\LtiBundle\Entity\ExternalTool;
use Doctrine\Persistence\ManagerRegistry;
use OAuthUtil;
use SimpleXMLElement;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
class ServiceController extends BaseController
{
/**
* @Route("/lti/os", name="chamilo_lti_os")
*/
public function outcomeServiceAction(Request $request): Response
public function __construct(
private ManagerRegistry $managerRegistry,
private TranslatorInterface $translator,
) {}
#[Route(path: '/lti/os', name: 'chamilo_lti_os')]
public function outcomeService(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$toolRepo = $em->getRepository(ExternalTool::class);
$headers = $request->headers;
@ -132,8 +137,8 @@ class ServiceController extends BaseController
break;
}
$serviceRequest->setEntityManager($this->getDoctrine()->getManager());
$serviceRequest->setTranslator($this->get('translator'));
$serviceRequest->setEntityManager($this->managerRegistry->getManager());
$serviceRequest->setTranslator($this->translator);
return $serviceRequest->process();
}

Loading…
Cancel
Save