简体   繁体   中英

TYPO3 The default controller for extension cannot be determined

I am creating an extension to list job offers, and when I try to see the view, I have this error message:

The default controller for extension "Offerjob" and plugin "JobList" can not be determined. Please check for 
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

I checked the namespaces of all my files, I tried some solutions and I can't resolve my issue, someone have an idea?

let check my files:

ext/offerjob/Classes/Controller/OfferjobController.php

namespace Vendor\Offerjob\Controller;

use Vendor\Offerjob\Domain\Repository\JobRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;


/**
 * Class OfferjobController
 *
 * @package Vendor\Offerjob\Controller
 */
class OfferjobController extends ActionController
{
    /**
     * @var JobRepository
     */
    private $jobRepository;

    /**
     * Inject the job repository
     *
     * @param \Vendor\Offerjob\Domain\Repository\JobRepository $jobRepository
     */
    public function injectJobRepository(JobRepository $jobRepository)
    {
        $this->jobRepository = $jobRepository;
    }

    /**
     * List Action
     *
     * @return void
     */
    public function listAction()
    {
        $jobs = $this->jobRepository->findAll();
        $this->view->assign('jobs', $jobs);
    }

}

public/typo3conf/ext/offerjob/ext_localconf.php



\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Vendor.Offerjob',
    'JobList',
    [
        \Vendor\Offerjob\Controller\OfferjobController::class => 'list',
    ],
    // non-cacheable actions
    [
        \Vendor\Offerjob\Controller\OfferjobController::class => '',
    ]
);

public/typo3conf/ext/offerjob/Configuration/TCA/Overrides/tt_content.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Vendor.Offerjob',
    'JobList',
    'Job list',
    'EXT:offerjob/Resources/Public/Icons/Extension.svg'
);

Is all the naming of plugins, namespace right? Is there something I'm doing wrong?

I'm Using TYPO3 10.4.21 and I followed this tutorial to make my extension: https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/4-FirstExtension/2-create-folder-structure-and-configuration-files.html

Remove the vendor part of the extension name as this is deprecated in v10 and will be removed in v11:

Vendor.Offerjob => Offerjob

Documentation: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.1/Deprecation-88995-CallingRegisterPluginWithVendorName.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM