简体   繁体   English

扩展自定义 TYPO3 9.5 扩展时出现问题 - 我无法在 controller 中添加操作

[英]Problem with extending custom TYPO3 9.5 extension - I can't add action in controller

In FE I have an error在 FE 我有一个错误

(1/1) #1186669086 TYPO3\CMS\Extbase\Mvc\Exception\NoSuchActionException
An action "showcandidateAction" does not exist in controller "Myvendor\VvApplicationform\Controller\ApplicationformController".

In ext_localconf.php I have a this在 ext_localconf.php 我有这个

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
 'Myvendor.VvApplicationform',
    'Candidateform',
    array(
        'Applicationform' => 'showcandidate',
    ),
    array(
        'Applicationform' => 'showcandidate',
    )
);

When I change the action in ext_localconf.php to another - I see correct form in FE.当我将 ext_localconf.php 中的操作更改为另一个时 - 我在 FE 中看到了正确的形式。 In controller - applicationform/Classes/Controller/ApplicationformController.php:在 controller - applicationform/Classes/Controller/ApplicationformController.php 中:

/*
  * @param \Myvendor\VvApplicationform\Domain\Model\CandidateApplication $application
  * @return void
  */
public function showcandidateAction(\Myvendor\VvApplicationform\Domain\Model\CandidateApplication $application = null) {
...
}

After changes I clear all cache and Dump autoload.更改后我清除所有缓存和转储自动加载。 But still have an error in FE.但是在FE中仍然有错误。 Of course I have a template here 'applicationform/Resources/Private/Templates/Applicationform/Showcandidate.html'当然我这里有一个模板'applicationform/Resources/Private/Templates/Applicationform/Showcandidate.html'

UP1 I forgot to notify that I'm using TYPO3 9.5 UP1 我忘了通知我正在使用 TYPO3 9.5

UP2 This is a registerPlugin in ext_tables.php: \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin('Myvendor.VvApplicationform', 'Candidateform', 'Candidate Form'); UP2 这是 ext_tables.php 中的 registerPlugin: \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin('Myvendor.VvApplicationform', 'Candidateform', 'Candidate Form');

UP3 - directory of this ext named vv_applicationform. UP3 - 这个名为 vv_applicationform 的分机目录。 I've updated wrong names in initial post.我在最初的帖子中更新了错误的名称。 This is ApplicationformController.php这是ApplicationformController.php

 namespace Myvendor\VvApplicationform\Controller;
    /**
 * Class ApplicationformController
 *
 * @package Myvendor\VvApplicationform\Controller
 */
class ApplicationformController extends ActionController
{

You've to configure your plugin differently:您必须以不同方式配置插件:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
 'applicationform',
    'Candidateform',
    array(
        Myvendor\Applicationform\Controller\ApplicationformController::class => 'showcandidate',
    ),
    array(
        Myvendor\Applicationform\Controller\ApplicationformController::class => 'showcandidate',
    )
);

A description about it you find here:您可以在此处找到有关它的描述:
https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ExtensionArchitecture/Extbase/Reference/FrontendPlugins.html#id2 https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ExtensionArchitecture/Extbase/Reference/FrontendPlugins.html#id2

I think there is a typo in CamelCase-writing.我认为 CamelCase 写作中有一个错字。

Extensionfolder: vv_applicationform Namespace: Myvendor\VvApplicationform...扩展文件夹:vv_applicationform 命名空间:Myvendor\VvApplicationform...

And then in ext_localconf.php is the bug.然后在 ext_localconf.php 是错误。 Replace 'Myvendor.Vvapplicationform' with 'Myvendor.VvApplicationform'将“Myvendor.Vvapplicationform”替换为“Myvendor.VvApplicationform”

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
 'Myvendor.VvApplicationform',
    'Candidateform',
    [
        'Applicationform' => 'showcandidate',
    ],
    [
        'Applicationform' => 'showcandidate',
    ]
);

From ExtensionUtility::configurePlugin(...)从 ExtensionUtility::configurePlugin(...)

 * @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore)

Finally I solved this issue.最后我解决了这个问题。 I was a stupid error - backup copy directory inside Controller directory.我是一个愚蠢的错误 - Controller 目录中的备份副本目录。 This is my tree:这是我的树:

-Controller
--Mybak_folder
  -ApplicationformController.php
--ApplicationformController.php

When I deleted directory "Mybak_folder" and Dump autoload from TYPO3 Maintenance I solved this problem... Thanks for all who trying to help当我从 TYPO3 维护中删除目录“Mybak_folder”和转储自动加载时,我解决了这个问题......感谢所有试图帮助的人

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TYPO3:在扩展控制器中添加自定义设置功能 - TYPO3: Add custom set functions in extension controller 如何覆盖 typo3 分机的 controller function? - How can I overwrite a controller function of a typo3 extension? TYPO3 添加和实现新闻扩展的动作 - TYPO3 add and implement action for news extension TYPO3 9.5-我的扩展中的QuerieResult缓存-null上的function map() - TYPO3 9.5 - QuerieResult Caching in my Extension - function map() on null Typo3调度程序:我可以通过它以某种方式执行扩展控制器的动作吗? 或者如何用它运行我自己的代码? - Typo3 scheduler: Can i somehow execute Action of controllers of my extension with it? Or how to run my own code with it? TYPO3中无法确定扩展和插件的默认控制器为ERROR - The default controller for extension and plugin can not be determined ERROR in TYPO3 TYPO3 9.5 中自定义页面 doktype 的站点路由 - Site routing for custom page doktypes in TYPO3 9.5 如何使用自定义映射器 TYPO3 9.5 从 URL 隐藏 arguments? - How to hide arguments from URL with a custom mapper TYPO3 9.5? Typ3 felogin 到自定义控制器? - typo3 felogin to custom controller? TYPO3:如何创建带有typeNum = 20的自定义页面类型url并在Controller上引用它 - TYPO3: How can i create a custom page type url with typeNum=20 and reference that on the Controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM