11#!/usr/bin/env php
22<?php
33
4+ use Shopware \Core \Framework \Adapter \Kernel \KernelFactory ;
45use Shopware \Core \Framework \Plugin \KernelPluginLoader \ComposerPluginLoader ;
56use Shopware \Core \HttpKernel ;
67use Symfony \Bundle \FrameworkBundle \Console \Application ;
@@ -29,8 +30,6 @@ return static function (array &$context) {
2930 $ env = $ input ->getParameterOption (['--env ' , '-e ' ], $ context ['APP_ENV ' ] ?? 'prod ' , true );
3031 $ debug = ($ context ['APP_DEBUG ' ] ?? ($ env !== 'prod ' )) && !$ input ->hasParameterOption ('--no-debug ' , true );
3132
32- $ pluginLoader = new ComposerPluginLoader ($ classLoader , null );
33-
3433 if ($ input ->getFirstArgument () === 'system:install ' ) {
3534 $ context ['INSTALL ' ] = true ;
3635 }
@@ -40,14 +39,24 @@ return static function (array &$context) {
4039 $ _SERVER ['DATABASE_URL ' ] = 'mysql://_placeholder.test ' ;
4140 }
4241
43- $ kernel = new HttpKernel ($ env , $ debug , $ classLoader );
44- $ kernel ->setPluginLoader ($ pluginLoader );
42+ if (method_exists (KernelFactory::class, "create " )) {
43+ $ kernel = KernelFactory::create (
44+ environment: $ env ,
45+ debug: $ debug ,
46+ classLoader: $ classLoader ,
47+ pluginLoader: new ComposerPluginLoader ($ classLoader , null )
48+ );
49+ } else {
50+ $ kernel = new HttpKernel ($ env , $ debug , $ classLoader );
51+ $ kernel ->setPluginLoader (new ComposerPluginLoader ($ classLoader , null ));
52+ $ kernel = $ kernel ->getKernel ();
53+ }
4554
46- $ application = new Application ($ kernel-> getKernel () );
47- $ kernel ->getKernel ()-> boot ();
55+ $ application = new Application ($ kernel );
56+ $ kernel ->boot ();
4857
4958 $ application ->setName ('Shopware ' );
50- $ application ->setVersion ($ kernel ->getKernel ()-> getContainer ()->getParameter ('kernel.shopware_version ' ));
59+ $ application ->setVersion ($ kernel ->getContainer ()->getParameter ('kernel.shopware_version ' ));
5160
5261 return $ application ;
5362};
0 commit comments