【问题标题】:TYPO3 and MySQL triggerTYPO3 和 MySQL 触发器
【发布时间】:2018-08-28 10:54:15
【问题描述】:

在扩展的 ext_tables.sql 文件中,我可以定义要添加到数据库中的新表/字段。

是否可以使用 TYPO3 将触发器 (MySQL) 也添加到数据库中?

【问题讨论】:

    标签: mysql typo3


    【解决方案1】:

    不是通过ext_tables.sql。

    安装扩展程序后,您可以使用扩展管理器信号槽并在那里执行查询

    ext_localconf.php 您的分机号:

    call_user_func(function($extensionKey) {
            $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
            $signalSlotDispatcher->connect(
                \TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService::class,
                'hasInstalledExtensions',
                function($keyOfInstalledExtension) use ($extensionKey) {
                    if ($extensionKey !== $keyOfInstalledExtension) {
                        return;
                    }
                    \Vendor\MyExt\Hooks\ExtensionManager::postInstallExtension();
                }
            );
        }
    }, $_EXTKEY);
    

    【讨论】:

    • 谢谢,但是在处理阶段/开发环境时安装和卸载扩展程序不是很方便,每次创建新安装时都需要考虑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-11
    相关资源
    最近更新 更多