-
Notifications
You must be signed in to change notification settings - Fork 15
RFC: 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
base: main
Are you sure you want to change the base?
Conversation
414402a
to
ccf7d2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors how the siteaccess
option is added to console commands by moving from a compiler pass approach to an application-level event listener. Instead of adding the option to individual command definitions during container compilation, the new approach adds the option to the application's input definition when any command is executed.
Key changes:
- Replaces per-command option injection with application-level option registration
- Ensures invokable commands receive the
--siteaccess
option without explicit configuration - Removes the need for manual option declaration in command classes
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/bundle/Core/EventListener/ApplicationCommandListener.php |
New event listener that adds siteaccess option to application definition on command execution |
src/bundle/Core/Resources/config/services.yml |
Registers the new ApplicationCommandListener as an event subscriber |
src/bundle/Core/IbexaCoreBundle.php |
Removes the ConsoleCommandPass compiler pass registration |
src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php |
Removes the compiler pass that added siteaccess option to individual commands |
tests/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPassTest.php |
Removes tests for the deleted compiler pass |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
|
||
namespace Ibexa\Bundle\Core\EventListener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
ConsoleEvents::COMMAND => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
ConsoleEvents::COMMAND => [ | |
ConsoleEvents::COMMAND => [ | |
// Use a high priority (256) to ensure this listener runs before other listeners, | |
// so that the 'siteaccess' option is available as early as possible. |
Copilot uses AI. Check for mistakes.
476f328
to
685bf2f
Compare
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare(strict_types=1);
is missing
|
Description:
This is a follow-up PR for #634 that contains a different solution, which changes how the
siteaccess
option is added.This ensures that invokable commands also receive
--siteaccess
as an option, without the need to addto command explicitly.
For QA:
Documentation: