Search code examples
typo3extbasetypo3-7.6.xtx-news

Extending extension with new actions


I'm migrating from 6.2 to 7.6 and I'm struggling with an extension(A) that extends another extension (b) that extends News (A-->B-->News). Everything is OK in 6.2 but not in 7.6.

I'm calling my action from Typoscript (lib.news.nextEvent)

lib.news.nextEvent < .related
nextEvent  {
    switchableControllerActions {
          News {
            1 = nextEventList
          }
    }

    settings {
        startingpoint = 123
        limit = 15

    link {
            skipControllerAndAction = 1
        }
    }
}

I have this error

Oops, an error occurred! Code: 201812181555070cca4167 - {"exception":"exception 'TYPO3\\CMS\\Extbase\\Mvc\\Exception\\NoSuchActionException' with message 'An action \"nextEventListAction\" does not exist in controller \"Roquin\\RoqNewsevent\\Controller\\EventController\"

TypoScript\setup.txt

config.tx_extbase {
    objects {
        Roquin\RoqNewsevent\Controller\EventController {
            className = QcMedia\QmNewsExtended\Controller\NewsExtendedController
        }
    }
}

In my controller i have (not the full actual class)

NewsExtendedController.php

use Roquin\RoqNewsevent\Controller\EventController;

class NewsExtendedController extends EventController

public function nextEventListAction(array $overwriteDemand = NULL)

Can someone give me a hint about that error? Thanks


Solution

  • Depending on which version of roq_newsevent you are use, the namespace is different in case:

    TYPO3 Extension Repository 3.1.1:

    ROQUIN\RoqNewsevent\Controller
    

    Fork from visol/ext-roq_newsevent 3.3.0:

    Roquin\RoqNewsevent\Controller
    

    This should not be a problem, but i am not sure about the implementation in TYPO3.

    config.tx_extbase {
        objects {
            ROQUIN\RoqNewsevent\Controller\EventController {
                className = QcMedia\QmNewsExtended\Controller\NewsExtendedController
            }
        }
    }
    

    You can try use XCLASS in ext_localconf.php instead of TypoScript config.tx_extbase.XXX

    $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['ROQUIN\\RoqNewsevent\\Controller\\EventController'] = [
       'className' => 'QcMedia\\QmNewsExtended\\Controller\\NewsExtendedController'
    ];