Shopware 6 插件的加载顺序是什么?
In which order are Shopware 6 plugins loaded?
composer 依赖链是否已兑现或仍是安装日期as written here?
根据changelog entry in Nov 2019,插件按照安装日期顺序加载。
The order of the loaded plugins has changed. Before, the plugins has been sorted by the ID column. Because of the UUIDs stored here, the order was random and changed on every (re)installation of Shopware.
From now on, the plugins are loaded in the order of their installation date. So the first installed plugin is the first, which is initialised on kernel boot.
This is temporary solution, as this will not fully resolve dependencies problems between plugins. There are already tickets open, which have the goal to improve the whole plugin loading process.
这在 the latest revision (25 Feb 2021)、
中仍然适用
protected function loadPluginInfos(): void
{
$sql = <<<SQL
# dbal-plugin-loader
SELECT
[...]
FROM `plugin`
ORDER BY `installed_at`; <---- here the sort order is defined
SQL;
所以即使解决方案不是临时的,至少目前已经建立了一致的加载顺序。
备注:关于主题覆盖的优先级,见 and Override twig template from plugin
未来:有一个core issue to tackle this.
Alex 已经回答了这个问题,但如果您想更好地控制插件的加载方式,这里有一个小提示。您可以在 src/Resources/theme.json
.
中定义主题中的顺序
例如在插件 Y 之前加载插件 X:
"views": [
"@Storefront",
"@Plugins",
"@PluginX",
"@PluginY",
"@YourTheme"
]
composer 依赖链是否已兑现或仍是安装日期as written here?
根据changelog entry in Nov 2019,插件按照安装日期顺序加载。
The order of the loaded plugins has changed. Before, the plugins has been sorted by the ID column. Because of the UUIDs stored here, the order was random and changed on every (re)installation of Shopware.
From now on, the plugins are loaded in the order of their installation date. So the first installed plugin is the first, which is initialised on kernel boot.
This is temporary solution, as this will not fully resolve dependencies problems between plugins. There are already tickets open, which have the goal to improve the whole plugin loading process.
这在 the latest revision (25 Feb 2021)、
中仍然适用protected function loadPluginInfos(): void
{
$sql = <<<SQL
# dbal-plugin-loader
SELECT
[...]
FROM `plugin`
ORDER BY `installed_at`; <---- here the sort order is defined
SQL;
所以即使解决方案不是临时的,至少目前已经建立了一致的加载顺序。
备注:关于主题覆盖的优先级,见
未来:有一个core issue to tackle this.
Alex 已经回答了这个问题,但如果您想更好地控制插件的加载方式,这里有一个小提示。您可以在 src/Resources/theme.json
.
例如在插件 Y 之前加载插件 X:
"views": [
"@Storefront",
"@Plugins",
"@PluginX",
"@PluginY",
"@YourTheme"
]