Plugins and AdditionalBundles
Last updated
Last updated
With dustin/shopware-utils you are able to create plugins for large projects without messing up your code. You can simply organize your features in multiple bundles and one main plugin with separate namespaces.
An additional bundle is simply a Symfony bundle - like a default Shopware plugin - but brings the ability for installation-, activation- and update-methods - like a default Shopware plugin.
Consider an AdditionalBundle a Shopware-plugin within a Shopware-plugin.
AdditionalBundles have their own installation, activation and update methods like a Shopware plugin, but cannot be installed or activated independently. Installation and activation are linked to the main plugin. So if you install or activate the main plugin, all inner bundles will also be installed and activated.
You also won't see AdditionalBundles as plugins in the Shopware administration.
The main plugin is a default Shopware plugin. It needs to extend from Dustin\ShopwareUtils\Core\Framework\Plugin
to handle it's AdditionalBundles and bring more advantages and features.
An additional bundle needs to extend from Dustin\ShopwareUtils\Core\Framework\AdditionalBundle
. It acts like a standalone default Shopware plugin, follows the same directory structure and can bring the same features like a theme, storefront-views, administration components, PHP-classes, migrations and so on.
Each Shopware plugin and AdditionalBundles bring the following installation- and activation methods:
You can overwrite each of this methods and implement your own installation-steps.
If you overwrite this methods never forget to call the parent method. Not calling the parent-method can lead to misbehavior and missing features like automatic custom field installation.
Both - the main plugin and AdditionalBundles - are able to automatically load Symfony service files. The following files will automatically be loaded for dependency injection if present:
Resources/config/services.{xml, php, yaml}
Core/Framework/DependencyInjection/*.{xml, php, yaml}
Core/DevOps/DependencyInjection/*.{xml, php, yaml}
Core/Maintenance/DependencyInjection/*.{xml, php, yaml}
Core/Profiling/DependencyInjection/*.{xml, php, yaml}
Core/System/DependencyInjection/*.{xml, php, yaml}
Core/Content/DependencyInjection/*.{xml, php, yaml}
Core/Checkout/DependencyInjection/*.{xml, php, yaml}
Administration/DependencyInjection/*.{xml, php, yaml}
Storefront/DependencyInjection/*.{xml, php, yaml}
ElasticSearch/DependencyInjection/*{xml, php, yaml}