$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Templates')); $container->set( ComponentInterface::class, function (Container $container) { $component = new TemplatesComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setRegistry($container->get(Registry::class)); return $component; } return $this->instance; } return $callable($this->container); } /** * Get the factory * } throw new KeyNotFoundException(sprintf("Resource '%s' has not been registered with the container.", $resourceName)); } return $this->resources[$key]->getInstance(); } /** * Check if specified resource exists. * 'container' => $container, ] ) ); $extension = $container->get($type); if ($extension instanceof BootableExtensionInterface) { $extension->boot($container); } $component = str_starts_with($component, 'com_') ? substr($component, 4) : $component; // Path to look for services $path = JPATH_ADMINISTRATOR . '/components/com_' . $component; return $this->loadExtension(ComponentInterface::class, $component, $path); } /** * Boots the module with the given name. * $cacheId = 'templates0' . $tag; if ($cache->contains($cacheId)) { $templates = $cache->get($cacheId); } else { $templates = $this->bootComponent('templates')->getMVCFactory() ->createModel('Style', 'Administrator')->getSiteTemplates(); foreach ($templates as &$template) { // Create home element if ($template->home == 1 && !isset($template_home) || $this->getLanguageFilter() && $template->home == $tag) { public function render(\Throwable $error): string { $app = Factory::getApplication(); // Get the current template from the application $template = $app->getTemplate(true); // Push the error object into the document $this->getDocument()->setError($error); // Add registry file for the template asset 'subject' => $app, 'document' => $renderer->getDocument(), ]) ); $data = $renderer->render($error); // If nothing was rendered, just use the message from the Exception if (empty($data)) { $data = $error->getMessage(); } * @since 3.10.0 */ public static function handleException(\Throwable $error) { static::logException($error); static::render($error); } /** * Render the error page based on an exception. * ); // Trigger the onError event. $this->dispatchEvent('onError', $event); ExceptionHandler::handleException($event->getError()); } // Trigger the onBeforeRespond event. $this->dispatchEvent( 'onBeforeRespond',// Set the application as global app\Joomla\CMS\Factory::$application = $app;// Execute the application.$app->execute(); * define() is used rather than "const" to not error for PHP 5.2 and lower */define('_JEXEC', 1);// Run the application - All executable code should be triggered through this filerequire_once dirname(__FILE__) . '/includes/app.php'; { if (!$this->exists()) { $this->create(); } $map = $this->cachedMap ?: require $this->file; $loader = include JPATH_LIBRARIES . '/vendor/autoload.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); */ public function createExtensionNamespaceMap() { \JLoader::register('JNamespacePsr4Map', JPATH_LIBRARIES . '/namespacemap.php'); $extensionPsr4Loader = new \JNamespacePsr4Map(); $extensionPsr4Loader->load(); }} public function execute() { try { $this->sanityCheckSystemVariables(); $this->setupLogging(); $this->createExtensionNamespaceMap(); // Perform application routines. $this->doExecute(); // If we have an application document object, render it.// Set the application as global app\Joomla\CMS\Factory::$application = $app;// Execute the application.$app->execute(); * define() is used rather than "const" to not error for PHP 5.2 and lower */define('_JEXEC', 1);// Run the application - All executable code should be triggered through this filerequire_once dirname(__FILE__) . '/includes/app.php';|
[2/2]
ClassNotFoundError
|
|---|
Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "TemplatesComponent" from namespace "Joomla\Component\Templates\Administrator\Extension".
Did you forget a "use" statement for another namespace?
at /home/sites/site3/web/administrator/components/com_templates/services/provider.php:46
at Joomla\DI\ServiceProviderInterface@anonymous /home/sites/site3/web/administrator/components/com_templates/services/provider.php:28$75->{closure}(object(Container))
(/home/sites/site3/web/libraries/vendor/joomla/di/src/ContainerResource.php:172)
at Joomla\DI\ContainerResource->getInstance()
(/home/sites/site3/web/libraries/vendor/joomla/di/src/Container.php:95)
at Joomla\DI\Container->get('Joomla\\CMS\\Extension\\ComponentInterface')
(/home/sites/site3/web/libraries/src/Extension/ExtensionManagerTrait.php:177)
at Joomla\CMS\Application\CMSApplication->loadExtension('Joomla\\CMS\\Extension\\ComponentInterface', 'templates', '/home/sites/site3/web/administrator/components/com_templates')
(/home/sites/site3/web/libraries/src/Extension/ExtensionManagerTrait.php:51)
at Joomla\CMS\Application\CMSApplication->bootComponent('templates')
(/home/sites/site3/web/libraries/src/Application/SiteApplication.php:464)
at Joomla\CMS\Application\SiteApplication->getTemplate(true)
(/home/sites/site3/web/libraries/src/Error/Renderer/HtmlRenderer.php:50)
at Joomla\CMS\Error\Renderer\HtmlRenderer->render(object(Error))
(/home/sites/site3/web/libraries/src/Exception/ExceptionHandler.php:136)
at Joomla\CMS\Exception\ExceptionHandler::render(object(Error))
(/home/sites/site3/web/libraries/src/Exception/ExceptionHandler.php:73)
at Joomla\CMS\Exception\ExceptionHandler::handleException(object(Error))
(/home/sites/site3/web/libraries/src/Application/CMSApplication.php:336)
at Joomla\CMS\Application\CMSApplication->execute()
(/home/sites/site3/web/includes/app.php:58)
at require_once('/home/sites/site3/web/includes/app.php')
(/home/sites/site3/web/index.php:32)
|
|
[1/2]
Error
|
|---|
Error:
Failed opening required '/home/sites/site3/web/administrator/cache/autoload_psr4.php' (include_path='.:/usr/share/php')
at /home/sites/site3/web/libraries/namespacemap.php:104
at JNamespacePsr4Map->load()
(/home/sites/site3/web/libraries/src/Application/ExtensionNamespaceMapper.php:34)
at Joomla\CMS\Application\CMSApplication->createExtensionNamespaceMap()
(/home/sites/site3/web/libraries/src/Application/CMSApplication.php:303)
at Joomla\CMS\Application\CMSApplication->execute()
(/home/sites/site3/web/includes/app.php:58)
at require_once('/home/sites/site3/web/includes/app.php')
(/home/sites/site3/web/index.php:32)
|