vendor/shopware/core/Framework/Plugin/KernelPluginLoader/DbalKernelPluginLoader.php line 10

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Plugin\KernelPluginLoader;
  3. use Composer\Autoload\ClassLoader;
  4. use Doctrine\DBAL\Connection;
  5. use Shopware\Core\Framework\Log\Package;
  6. #[Package('core')]
  7. class DbalKernelPluginLoader extends KernelPluginLoader
  8. {
  9.     public function __construct(
  10.         ClassLoader $classLoader,
  11.         ?string $pluginDir,
  12.         private readonly Connection $connection
  13.     ) {
  14.         parent::__construct($classLoader$pluginDir);
  15.     }
  16.     protected function loadPluginInfos(): void
  17.     {
  18.         $sql = <<<'SQL'
  19.         # dbal-plugin-loader
  20.         SELECT
  21.                `name`,
  22.                `base_class` AS baseClass,
  23.                IF(`active` = 1 AND `installed_at` IS NOT NULL, 1, 0) AS active,
  24.                `path`,
  25.                `version`,
  26.                `autoload`,
  27.                `managed_by_composer` AS managedByComposer,
  28.                composer_name as composerName
  29.         FROM `plugin`
  30.         ORDER BY `installed_at`;
  31. SQL;
  32.         $plugins $this->connection->executeQuery($sql)->fetchAllAssociative();
  33.         foreach ($plugins as $i => $plugin) {
  34.             $plugins[$i]['active'] = (bool) $plugin['active'];
  35.             $plugins[$i]['managedByComposer'] = (bool) $plugin['managedByComposer'];
  36.             $plugins[$i]['autoload'] = json_decode((string) $plugin['autoload'], true512\JSON_THROW_ON_ERROR);
  37.         }
  38.         $this->pluginInfos $plugins;
  39.     }
  40. }