public function loadPlugins()
    {
        $oldPlugins = $this->getExistingPlugins();
        $pluginBundles = $this->getInstalledPluginBundles($this->kernel);
        $pluginsLoaded = [];

        /**
         * @var Bundle $plugin
         */
        foreach ($pluginBundles as $plugin) {
            $pluginConfiguration = $this
                ->pluginLoader
                ->getPluginConfiguration($plugin->getPath());

            $pluginNamespace = get_class($plugin);
            $pluginInstance = $this
                ->getPluginInstance(
                    $pluginNamespace,
                    $pluginConfiguration
                );

            if (isset($oldPlugins[$pluginNamespace])) {
                $existingPlugin = $oldPlugins[$pluginNamespace];
                $pluginInstance = $existingPlugin->merge($pluginInstance);
                unset($oldPlugins[$pluginNamespace]);
            }

            $this->savePlugin($pluginInstance);

            $pluginsLoaded[] = $pluginInstance;
        }

        /**
         * Every Plugin instance inside $plugins array should be removed from
         * database, because they are not longer installed.
         */
        $this->removePlugins($oldPlugins);

        return $pluginsLoaded;
    }
public function loadPlugins()
    {
        $oldPlugins = $this->getExistingPlugins();
        $pluginBundles = $this->getInstalledPluginBundles($this->kernel);
        $pluginsLoaded = [];

        /**
         * @var Bundle $plugin
         */
        foreach ($pluginBundles as $plugin) {
            $pluginConfiguration = $this
                ->pluginLoader
                ->getPluginConfiguration($plugin->getPath());

            $pluginNamespace = get_class($plugin);
            $pluginInstance = $this
                ->getPluginInstance(
                    $pluginNamespace,
                    $pluginConfiguration
                );

            if (isset($oldPlugins[$pluginNamespace])) {
                $existingPlugin = $oldPlugins[$pluginNamespace];
                $pluginInstance = $existingPlugin->merge($pluginInstance);
                unset($oldPlugins[$pluginNamespace]);
            }

            $this->savePlugin($pluginInstance);

            $pluginsLoaded[] = $pluginInstance;
        }

        /**
         * Every Plugin instance inside $plugins array should be removed from
         * database, because they are not longer installed.
         */
        $this->removePlugins($oldPlugins);

        return $pluginsLoaded;
    }
public function loadPlugins ( ) { $ oldPlugins = $ this -> getExistingPlugins ( ) ; $ pluginBundles = $ this -> getInstalledPluginBundles ( $ this -> kernel ) ; $ pluginsLoaded = [ ] ; /**
         * @var Bundle $plugin
         */ foreach ( $ pluginBundles as $ plugin ) { $ pluginConfiguration = $ this -> pluginLoader -> getPluginConfiguration ( $ plugin -> getPath ( ) ) ; $ pluginNamespace = get_class ( $ plugin ) ; $ pluginInstance = $ this -> getPluginInstance ( $ pluginNamespace , $ pluginConfiguration ) ; if ( isset ( $ oldPlugins [ $ pluginNamespace ] ) ) { $ existingPlugin = $ oldPlugins [ $ pluginNamespace ] ; $ pluginInstance = $ existingPlugin -> merge ( $ pluginInstance ) ; unset ( $ oldPlugins [ $ pluginNamespace ] ) ; } $ this -> savePlugin ( $ pluginInstance ) ; $ pluginsLoaded [ ] = $ pluginInstance ; } /**
         * Every Plugin instance inside $plugins array should be removed from
         * database, because they are not longer installed.
         */ $ this -> removePlugins ( $ oldPlugins ) ; return $ pluginsLoaded ; }
Load plugins.

This method will look for new plugins installed in our kernel and will
try to install them. It will look for already installed plugins as well,
and update with new information, maintaining old values.

@return Plugin[] Plugins loaded
Load plugins .