Skip to content
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

Add ConfigurationHelperInterface #568

Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Nov 7, 2017

I had this problem a few days ago: needed to override the ConfigurationHelper to be able to inject a custom finder implementation in DoctrineMigrationsBundle. Since the class is marked as internal (and should probably be final in 2.0), it makes sense adding an interface to allow people to supply their own configuration helper.

@alcaeus alcaeus added this to the 1.6 milestone Nov 7, 2017
@alcaeus alcaeus self-assigned this Nov 7, 2017
Copy link
Contributor

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the Configuration system, but other than one comment, looks ok to me :)

@@ -88,7 +89,7 @@ protected function getMigrationConfiguration(InputInterface $input, OutputInterf
{
if ( ! $this->migrationConfiguration) {
if ($this->getHelperSet()->has('configuration')
&& $this->getHelperSet()->get('configuration') instanceof ConfigurationHelper) {
&& $this->getHelperSet()->get('configuration') instanceof ConfigurationHelperInterface) {
$configHelper = $this->getHelperSet()->get('configuration');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the configuration helper set exists, but it does not implement ConfigurationHelperInterface, could we throw an Exception instead? It seems like a misconfiguration - and it would silently fallback to the normal one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I'd love to throw an exception, configuration is too generic to assume that there should only be a migrations configuration helper in there. An exception might be overkill, but we should think about how to make this more specific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that makes sense, ok :)

@alcaeus alcaeus merged commit 327acbf into doctrine:master Nov 9, 2017
@alcaeus alcaeus deleted the add-configuration-helper-interface branch November 9, 2017 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants