lochmueller / calendarize

📆 Best TYPO3 Calendar ever 📆
http://typo3.org/extensions/repository/view/calendarize
75 stars 84 forks source link

FE error No valid configuration for the current index: MyEvent #794

Closed blueamerican closed 3 months ago

blueamerican commented 4 months ago

Hello,

i get sometimes the error, see also attached screen.

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #123678123: No valid configuration for the current index: MyEvent | HDNET\Calendarize\Exception\InvalidConfigurationException thrown in file /kunden/../typo3conf/ext/calendarize/Classes/Domain/Model/Index.php in line 143. Requested URL: https://www.hachenburger-kulturzeit.de/programm/festefestivals/monat/2024/4

https://www.hachenburger-kulturzeit.de/programm/querbeet/monat/2024/5 https://www.hachenburger-kulturzeit.de https://www.hachenburger-kulturzeit.de/musik

It has to do with the cache. I f i clear the cache, the error sometimes diappears.

Has anybody an idea, where my fault is?

Most of the time it works, but sometimes the error appears.

strange is: if i open the page first in firefox (mac), it works https://www.hachenburger-kulturzeit.de/programm/querbeet/monat/2024/4 if i open the page first in chrome or safari (mac), the error comes

after opening a page in firefox, it also works in other browsers (cache)

TYPO3 11 calendarize 12.4.4 autoloader 7.4.4 own exension with own model _Bildschirmfoto 2024-03-05 um 09 44 31 Kopie

lochmueller commented 4 months ago

How do you register the MyEvent calendairze data structure. In the ext_localconf.php like here https://github.com/lochmueller/calendarize/blob/master/ext_localconf.php#L25 ? Perhaps you put the registration in ext_tables.php? Regards, Tim

blueamerican commented 4 months ago

I have this in the ext_tables.php from my extension

(static function() {
    $configuration = [
        'uniqueRegisterKey' => 'MyEvent', // A unique Key for the register (e.g. you Extension Key + "Event")
        'title'             => 'My Event', // The title for your events (this is shown in the FlexForm configuration of the Plugins)
        'modelName'         => \MarkusDuebbert\Myevent\Domain\Model\Myevent::class, // the name of your model
        'partialIdentifier' => 'MyEvent', // the identifier of the partials for your event. In most cases this is also unique
        'tableName'         => 'tx_myevent_domain_model_myevent', // the table name of your event table
        'required'          => true, // set to true, than your event need a least one event configuration
        //'subClasses'        => array of classnames, // insert here all classNames, which are used for the extended models
    ];
    \HDNET\Calendarize\Register::extTables($configuration);

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_myevent_domain_model_myevent', 'EXT:myevent/Resources/Private/Language/locallang_csh_tx_myevent_domain_model_myevent.xlf');
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_myevent_domain_model_myevent');

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_myevent_domain_model_tags', 'EXT:myevent/Resources/Private/Language/locallang_csh_tx_myevent_domain_model_tags.xlf');
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_myevent_domain_model_tags');
})();
lochmueller commented 4 months ago

And do you call this in your ext_localconf.php of your extension too? https://github.com/lochmueller/calendarize/blob/master/Classes/Register.php#L36

 $configuration = [
        'uniqueRegisterKey' => 'MyEvent', // A unique Key for the register (e.g. you Extension Key + "Event")
        'title'             => 'My Event', // The title for your events (this is shown in the FlexForm configuration of the Plugins)
        'modelName'         => \MarkusDuebbert\Myevent\Domain\Model\Myevent::class, // the name of your model
        'partialIdentifier' => 'MyEvent', // the identifier of the partials for your event. In most cases this is also unique
        'tableName'         => 'tx_myevent_domain_model_myevent', // the table name of your event table
        'required'          => true, // set to true, than your event need a least one event configuration
        //'subClasses'        => array of classnames, // insert here all classNames, which are used for the extended models
    ];
    \HDNET\Calendarize\Register::extLocalconf($configuration);

ext_tables.php is for backend context and ext_localconf.php for every context. If you call a FE page, without backend session perhaps you will get this error, because the registration is missing in FE.

blueamerican commented 3 months ago

@lochmueller

This was exactly my fault.. i didn't had a call in ext_localconf.php, only in ext_tables.php

i did it now as described here:

https://docs.typo3.org/p/lochmueller/calendarize/12.4/en-us/DeveloperManual/OwnEvents/Index.html

it works.. thanks a lot!