Joomla! 4 - Service Provider fails to see Class

271 views
Skip to first unread message

Glenn Arkell

unread,
Dec 22, 2020, 11:24:14 PM12/22/20
to Joomla! General Development
Trying out the J4 file structure for a component but stumbled on a namespace problem.

Class 'GlennArkell\Component\Mycomp\Administrator\Extension\MycompComponent' not found

Installs all successful.  When trying to view the multiples listing in admin side I get the above error message.  The following line in my "administrator/services/provider.php" file -

$component = new  MycompComponent($container->get(ComponentDispatcherFactoryInterface::class));

and I have the following declared at the top of the page -

use \GlennArkell\Component\Mycomp\Administrator\Extension\MycompComponent;

What am I missing?  Any and all guidance appreciated.  Cheers.
Glenn

Glenn Arkell

unread,
Dec 23, 2020, 1:04:44 AM12/23/20
to Joomla! General Development
I should add, I have file structure as follows:
src/Extension/MycompComponent.php
This file has -:
namespace GlennArkell\Component\Mycomp\Administrator\Extension;
class MycompComponent extends MVCComponent implements BootableExtensionInterface, RouterServiceInterface
{ . . .}

Glenn Arkell

unread,
Dec 23, 2020, 1:36:49 AM12/23/20
to Joomla! General Development
Ok found the answer to this problem, needed to have path="src" in the namespace element in the manifest.  Cheers.
Glenn

Darren Forster

unread,
Dec 23, 2020, 1:39:06 AM12/23/20
to joomla-de...@googlegroups.com
Try removing the class name from the use statement as it can't find the namespace with the class in there.

"I have the following declared at the top of the page -

use \GlennArkell\Component\Mycomp\Administrator\Extension\MycompComponent;"

use \GlenArkell\Component\Mycomp\Administrator\Extension ;


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/2e0b5c15-a92f-4eea-b0fa-3a09b3204d37n%40googlegroups.com.

Glenn Arkell

unread,
Dec 23, 2020, 4:47:22 AM12/23/20
to Joomla! General Development
Thanks Darren for the suggestion.  Will keep working through the issues as they pop up, this was just the first of several things I still had wrong.  Cheers.
Glenn
Reply all
Reply to author
Forward
0 new messages