C5-8.4* Class not found

Permalink
Following this for v8.4.0:
https://documentation.concrete5.org/developers/packages/adding-custo...

package controller:
use MyPackageClasses\Utilities\Installer;
    public function getEntityManagerProvider()
    {
        $provider = new StandardPackageProvider($this->app, $this, [
            'src/MyPackageClasses' => '\MyPackageClasses'
        ]);
        return $provider;
    }

Dashboard page controller:
<?php
use MyPackageClasses\Item\ItemList as MyItemList;
class Cars extends DashboardPageController
{
    public function view($gID=null){
        $items = new MyItemList();

ItemList.php in src/MyPackageClasses/Item/:
<?php
namespace MyPackageClasses\Item;
class ItemList extends AttributedItemList
{

It throws an error: 'Class 'MyPackageClasses\Item\ItemList' not found' at the Items Dashboard controller line '$items = new MyItemsList();'.

What's wrong here?

linuxoid
 
linuxoid replied on at Permalink Reply
linuxoid
Changing
'src/MyPackageClasses' => '\MyPackageClasses'

to
'src/MyPackageClasses' => 'MyPackageClasses'

fixed it.

I noticed some write use \Concrete... and other omit the '\'. Some even include it in one line and omit it right on the next line.

Is the back slash important?

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.