简体   繁体   English

TYPO3和MySQL触发器

[英]TYPO3 and MySQL trigger

In ext_tables.sql file of an extension I can define new tables/fields that are going to be added to the database. 在扩展的ext_tables.sql文件中,我可以定义将要添加到数据库中的新表/字段。

Is it possible with TYPO3 to add also Triggers (MySQL) to database? TYPO3是否可以向数据库中添加触发器(MySQL)?

Not via ext_tables.sql . 不通过ext_tables.sql

You can use the extension manager signal slot and execute your queries there after installation of your extension 您可以在安装扩展程序后使用扩展程序管理器信号槽并在其中执行查询

ext_localconf.php of your extension: 您的扩展程序的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);

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

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