0
votes

The current Behavior:
I wanted to add an extra custom type and followed:

https://docs.typo3.org/p/georgringer/news/master/en-us/DeveloperManual/ExtendNews/AddCustomType/Index.html

Exactly at it was explained there...
The expected behavior/output:
This gives me in the Backend an extra custom type myCustomNewsType.

However, when I call the Frontend, I get:

Core: Exception handler (WEB): Uncaught TYPO3 Exception:
#1476045117: Could not find class definition for name "Galileocr\CustomPackage\Domain\Model\MyCustomNewsType".
This could be caused by a mis-spelling of the class name in the class definition. | TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidClassException thrown in file /usr/home/galileo98/public_html/typo3_src-9.5.11/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php in line 131.

Environment

  • TYPO3 version(s): [9.5.0]
  • news version: [e.g. 7.0.5]
  • Composer (Composer Mode): [ no]
  • OS: [e.g. OSX 10.13.4]

I have no idea why this occurs, is this example not complete?

2

2 Answers

0
votes

Did you configure the class autoloading after adding the new class? If this is a try-out, you should add an autoloading line to the composer.json in the root of your project.

    {
            "autoload": {
                    "psr-4": {
                        "Galileocr\\CustomPackage\\": "typo3conf/ext/custom_package/Classes/"
                    }
            }
    }

After that you should regenerate the autoload files by issuing a composer dumpautoload from the directory in which you just edited the composer.json.

0
votes

I did not make the TYPO3 install with composer (no composer file in the root of my project), did it the "classical" way.

However, you definitely pointed me in the right direction: I opened the file typo3conf/autoload/autoload_psr4.php:

<?php

// autoload_classmap.php @generated by TYPO3

$typo3InstallDir = \TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/';

return array(
    'BK2K\\BootstrapPackage\\' => array($typo3InstallDir . 'typo3conf/ext/bootstrap_package/Classes'),
    'GeorgRinger\\News\\' => array($typo3InstallDir . 'typo3conf/ext/news/Classes'),
);

So no reference to my custom class...

Therefore, I went to Admin tools->Maintenance->Rebuild PHP Autoload Information and refreshed the autoload info. After that, the same file looks like this:

<?php

// autoload_classmap.php @generated by TYPO3

$typo3InstallDir = \TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/';

return array(
    'BK2K\\BootstrapPackage\\' => array($typo3InstallDir . 'typo3conf/ext/bootstrap_package/Classes'),
    'Galileocr\\BciePackage\\' => array($typo3InstallDir . 'typo3conf/ext/bcie_package/Classes'),
    'GeorgRinger\\News\\' => array($typo3InstallDir . 'typo3conf/ext/news/Classes'),
);

The the problem was fixed!!!

Thanks and regards!

Bert