Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 603

Joomla! 4.x Coding • Re: How to fix error 00 Call to a member function get() on null ($listOrder)

$
0
0
You're passing the wrong namespace prefix in your service provider:

Code:

$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Faq'));$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Faq'));
Instead of your "$this->thing = $model->get<thing>();" lines you want "$this->thing = $this->get('<thing>');".
Please don't follow this advice. It's an ancient borderline magic method that only makes things harder to debug. It really should have been removed a long time ago.
Thanks, I fixed provider.php, but again I got the same error like in my first message of this topic:

Code:

0 Call to a member function get() on null in JROOT/administrator/components/com_faq/tmpl/faqcontent/default.php:17
service/provider.php:

Code:

<?phpdefined('_JEXEC') or die;use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;use Joomla\CMS\Extension\ComponentInterface;use Joomla\CMS\Extension\MVCComponent;use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;use Joomla\CMS\Extension\Service\Provider\MVCFactory;use Joomla\CMS\MVC\Factory\MVCFactoryInterface;use Joomla\DI\Container;use Joomla\DI\ServiceProviderInterface;return new class implements ServiceProviderInterface {        public function register(Container $container): void {        $container->registerServiceProvider(new MVCFactory('\\VPJoomla\\Component\\Faq'));        $container->registerServiceProvider(new ComponentDispatcherFactory('\\VPJoomla\\Component\\Faq'));        $container->set(            ComponentInterface::class,            function (Container $container) {                $component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));                $component->setMVCFactory($container->get(MVCFactoryInterface::class));                return $component;            }        );    }};?>

Statistics: Posted by zeus07 — Thu Mar 28, 2024 9:28 am



Viewing all articles
Browse latest Browse all 603

Latest Images

Trending Articles





Latest Images