diff --git a/src/Console/Command/BaseAspectCommand.php b/src/Console/Command/BaseAspectCommand.php index f34b84da..1742c7ff 100644 --- a/src/Console/Command/BaseAspectCommand.php +++ b/src/Console/Command/BaseAspectCommand.php @@ -37,16 +37,26 @@ protected function configure() } /** - * {@inheritDoc} + * Loads aspect kernel. + * + * Aspect kernel is loaded by executing loader and fetching singleton instance. + * If your application environment initializes aspect kernel differently, you may + * modify this metod to get aspect kernel suitable to your needs. + * + * @param InputInterface $input + * @param OutputInterface $output */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function loadAspectKernel(InputInterface $input, OutputInterface $output) { $loader = $input->getArgument('loader'); $path = stream_resolve_include_path($loader); if (!is_readable($path)) { throw new \InvalidArgumentException("Invalid loader path: {$loader}"); } + + ob_start(); include_once $path; + ob_clean(); if (!class_exists(AspectKernel::class, false)) { $message = "Kernel was not initialized yet, please configure it in the {$path}"; diff --git a/src/Console/Command/CacheWarmupCommand.php b/src/Console/Command/CacheWarmupCommand.php index d49c4c59..fa11885e 100644 --- a/src/Console/Command/CacheWarmupCommand.php +++ b/src/Console/Command/CacheWarmupCommand.php @@ -45,7 +45,8 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - parent::execute($input, $output); + $this->loadAspectKernel($input, $output); + $options = $this->aspectKernel->getOptions(); if (empty($options['cacheDir'])) { diff --git a/src/Console/Command/DebugAdvisorCommand.php b/src/Console/Command/DebugAdvisorCommand.php index eefaaef1..153b11b3 100644 --- a/src/Console/Command/DebugAdvisorCommand.php +++ b/src/Console/Command/DebugAdvisorCommand.php @@ -49,7 +49,8 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - parent::execute($input, $output); + $this->loadAspectKernel($input, $output); + $io = new SymfonyStyle($input, $output); $io->title('Advisor debug information'); diff --git a/src/Console/Command/DebugAspectCommand.php b/src/Console/Command/DebugAspectCommand.php index e44259c7..226ba5da 100644 --- a/src/Console/Command/DebugAspectCommand.php +++ b/src/Console/Command/DebugAspectCommand.php @@ -46,7 +46,8 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - parent::execute($input, $output); + $this->loadAspectKernel($input, $output); + $io = new SymfonyStyle($input, $output); $container = $this->aspectKernel->getContainer();