Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Application.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\Console;
8
9 use eZ\Publish\Core\MVC\Symfony\Event\ConsoleInitEvent;
10 use eZ\Publish\Core\MVC\Symfony\MVCEvents;
11 use Symfony\Bundle\FrameworkBundle\Console\Application as BaseApplication;
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Input\InputOption;
14 use Symfony\Component\Console\Output\OutputInterface;
15 use Symfony\Component\HttpKernel\KernelInterface;
16
21 class Application extends BaseApplication
22 {
28 private $kernel;
29
30 public function __construct(KernelInterface $kernel)
31 {
32 $this->kernel = $kernel;
33 parent::__construct($kernel);
34 $this->getDefinition()->addOption(
35 new InputOption('--siteaccess', null, InputOption::VALUE_OPTIONAL, 'SiteAccess to use for operations. If not provided, default siteaccess will be used')
36 );
37 }
38
39 public function doRun(InputInterface $input, OutputInterface $output)
40 {
41 // boot() will be re-executed by parent, but kernel only boots once regardlessly
42 $this->kernel->boot();
43
44 // @todo Contribute a console.init event to Symfony4 in order to rather use that in v3 to drop doRun() overload
45 $this->kernel->getContainer()->get('event_dispatcher')->dispatch(
46 MVCEvents::CONSOLE_INIT,
47 new ConsoleInitEvent($input, $output)
48 );
49
50 return parent::doRun($input, $output);
51 }
52 }
eZ\Bundle\EzPublishCoreBundle\Console\Application
eZ Publish console application.
Definition: Application.php:22
eZ\Bundle\EzPublishCoreBundle\Console\Application\doRun
doRun(InputInterface $input, OutputInterface $output)
Definition: Application.php:39
eZ\Bundle\EzPublishCoreBundle\Console\Application\__construct
__construct(KernelInterface $kernel)
Definition: Application.php:30
eZ\Bundle\EzPublishCoreBundle\Console\Application\$kernel
$kernel
Definition: Application.php:28
eZ\Publish\Core\MVC\Symfony\Event\ConsoleInitEvent
Allows to do things before the command is loaded, like configuring system based on input.
Definition: ConsoleInitEvent.php:17
eZ\Publish\Core\MVC\Symfony\MVCEvents
Definition: MVCEvents.php:10
eZ\Publish\Core\MVC\Symfony\MVCEvents\CONSOLE_INIT
const CONSOLE_INIT
The CONSOLE_INIT event allows you to attach listeners before any command is loaded by the console.
Definition: MVCEvents.php:97
eZ\Bundle\EzPublishCoreBundle\Console
Definition: Application.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.