-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console][Lock] Allow LockableTrait to use custom stores #31914
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 1 commit
38e7a8a
7b375db
c097950
51626d9
dff0863
ac74dde
cf89732
300bcc8
588d6d9
9605bdc
c1f3749
bbfb8aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
… the AddConsoleCommandPass
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,8 @@ private function release() | |
|
||
/** | ||
* Sets the internal store for the command to be used. | ||
* | ||
* @param StoreInterface $store | ||
*/ | ||
public function setStore(StoreInterface $store) | ||
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. what about passing a non-default store as optional 3rd arg in 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. meaning the user injects his own store if needed 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. If that's the case then this change wouldn't be needed because you can implement the 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. Right ... the user can also set We should favor pure DI / service usage IMHO. 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. I'm trying to solve a configurable store that can be used in commands, this can either be done by:
Why? Because currently 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.
Is that a real problem? IMHO it's the explicit way.. compared to calling an arbitrary 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. I agree that we should be using a marker interface. I've updated the PR. |
||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,13 @@ public function process(ContainerBuilder $container) | |
if ($aliases) { | ||
$definition->addMethodCall('setAliases', [$aliases]); | ||
} | ||
|
||
$storeDefinition = 'lock.store'; | ||
if ($container->hasDefinition($storeDefinition)) { | ||
stixx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (\method_exists($definition->getClass(), 'setStore')) { | ||
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. I'm a bit unsure about injecting the store based on method existence. |
||
$definition->addMethodCall('setStore', [$container->getDefinition($storeDefinition)]); | ||
stixx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
$container | ||
|
Uh oh!
There was an error while loading. Please reload this page.