Fixes deprecated constants to class constants
🔧 configure it!
-$logLevel = TL_ACCESS;
+$logLevel = \Contao\CoreBundle\Monolog\ContaoContext::ACCESS;
Fixes deprecated constants to service calls
🔧 configure it!
-$requestToken = REQUEST_TOKEN;
+$requestToken = \Contao\System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue();
Fixes deprecated constants to service parameters
🔧 configure it!
-$projectDir = TL_ROOT;
+$projectDir = \Contao\System::getContainer()->getParameter('kernel.project_dir');
Rewrites session access to the request stack session
-\Contao\System::getContainer()->get('session');
+\Contao\System::getContainer()->get('request_stack')->getSession();
Fixes deprecated Controller::createInitialVersion()
and Controller::createNewVersion()
to Versions class calls
-\Contao\Controller::createInitialVersion('tl_page', 17);
-\Contao\Controller::createNewVersion('tl_page', 17);
+(new \Contao\Versions('tl_page', 17))->initialize();
+(new \Contao\Versions('tl_page', 17))->create();
Fixes deprecated Controller::replaceInsertTags()
to service calls
-$buffer = \Contao\Controller::replaceInsertTags($buffer);
-$uncached = \Contao\Controller::replaceInsertTags($buffer, false);
-$class = (new \Contao\InsertTags())->replace($buffer);
+$buffer = \Contao\System::getContainer('contao.insert_tags.parser')->replace($buffer);
+$uncached = \Contao\System::getContainer('contao.insert_tags.parser')->replaceInline($buffer);
+$class = \Contao\System::getContainer('contao.insert_tags.parser')->replace($buffer);
Fixes deprecated legacy framework method to static calls
🔧 configure it!
-$ids = \Contao\Controller::getChildRecords([42], 'tl_page');
-$ids = \Contao\Controller::getParentRecords(42, 'tl_page');
+$ids = \Contao\Database::getInstance()->getChildRecords([42], 'tl_page');
+$ids = \Contao\Database::getInstance()->getParentRecords(42, 'tl_page');
Fixes deprecated legacy framework method to service calls
🔧 configure it!
-$buffer = $this->parseSimpleTokens($buffer, $arrTokens);
+$buffer = \Contao\System::getContainer()->get('contao.string.simple_token_parser')->parse($buffer, $arrTokens);
Fixes deprecated legacy framework method to static calls
🔧 configure it!
-$html = \Contao\Controller::getImage($image, $width, $height);
-$html = $this->getImage($image, $width, $height);
+$html = \Contao\Image::get($image, $width, $height);
+$html = \Contao\Image::get($image, $width, $height);
Fixes deprecated login constants to security service call
-$hasFrontendAccess = FE_USER_LOGGED_IN;
-$hasBackendAccess = BE_USER_LOGGED_IN;
+$hasFrontendAccess = \Contao\System::getContainer()->get('security.helper')->isGranted('ROLE_MEMBER');
+$hasBackendAccess = \Contao\System::getContainer()->get('contao.security.token_checker')->isPreviewMode();
Fixes deprecated TL_MODE constant to service call
-$isBackend = TL_MODE === 'BE';
+$isBackend = \Contao\System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(\Contao\System::getContainer()->get('request_stack')->getCurrentRequest() ?? \Symfony\Component\HttpFoundation\Request::create(''));
Fixes deprecated \Contao\System::getLanguages()
method to service call
-$languaegs = \Contao\System::getLanguages();
+$languages = \Contao\System::getContainer()->get('contao.intl.locales')->getLocales(null, true);
Rewrites deprecated System::log()
calls to Monolog
-\Contao\System::log('generic log message', __METHOD__, TL_ACCESS);
-\Contao\System::log('error message', __METHOD__, TL_ERROR);
+\Contao\System::getContainer()->get('logger')->log(\Psr\Log\LogLevel::INFO, 'generic log message', ['contao' => new \Contao\CoreBundle\Monolog\ContaoContext(__METHOD__, \Contao\CoreBundle\Monolog\ContaoContext::ACCESS)]);
+\Contao\System::getContainer()->get('logger')->log(\Psr\Log\LogLevel::ERROR, 'error message', ['contao' => new \Contao\CoreBundle\Monolog\ContaoContext(__METHOD__, \Contao\CoreBundle\Monolog\ContaoContext::ERROR)]);