-
Notifications
You must be signed in to change notification settings - Fork 15
IBX-10428: Added siteaccess
option to application definition, instead of per command
#635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,49 @@ | ||||||||||
<?php | ||||||||||
|
||||||||||
/** | ||||||||||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||||||||||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||||||||||
*/ | ||||||||||
declare(strict_types=1); | ||||||||||
|
||||||||||
namespace Ibexa\Bundle\Core\EventListener; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The class is missing a docblock that explains its purpose. Consider adding a class-level docblock to describe that this listener adds the siteaccess option to the application's input definition for all console commands. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
|
||||||||||
use Symfony\Component\Console\ConsoleEvents; | ||||||||||
use Symfony\Component\Console\Event\ConsoleCommandEvent; | ||||||||||
use Symfony\Component\Console\Input\InputOption; | ||||||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||||||||||
|
||||||||||
final class ApplicationCommandListener implements EventSubscriberInterface | ||||||||||
{ | ||||||||||
public static function getSubscribedEvents(): array | ||||||||||
{ | ||||||||||
return [ | ||||||||||
ConsoleEvents::COMMAND => [ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The magic number 256 for the event priority lacks explanation. Consider adding a comment explaining why this specific priority is chosen, especially since it's quite high and suggests it needs to run before other listeners.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
['onConsoleCommand', 256], | ||||||||||
], | ||||||||||
]; | ||||||||||
} | ||||||||||
|
||||||||||
public function onConsoleCommand(ConsoleCommandEvent $event): void | ||||||||||
{ | ||||||||||
$command = $event->getCommand(); | ||||||||||
if ($command === null) { | ||||||||||
return; | ||||||||||
} | ||||||||||
|
||||||||||
$application = $command->getApplication(); | ||||||||||
if ($application === null) { | ||||||||||
return; | ||||||||||
} | ||||||||||
|
||||||||||
$inputDefinition = $application->getDefinition(); | ||||||||||
if (false === $inputDefinition->hasOption('siteaccess')) { | ||||||||||
Steveb-p marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
$inputDefinition->addOption(new InputOption( | ||||||||||
'siteaccess', | ||||||||||
null, | ||||||||||
InputOption::VALUE_OPTIONAL, | ||||||||||
'SiteAccess to use for operations. If not provided, default siteaccess will be used', | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
)); | ||||||||||
} | ||||||||||
} | ||||||||||
} |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.