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

Migrations v3 - cli-config.php must return an instance of DependencyFactory #986

Closed
acelaya opened this issue Jun 14, 2020 · 8 comments
Closed
Assignees
Labels

Comments

@acelaya
Copy link

acelaya commented Jun 14, 2020

Q A
Version 3.0.0

Support Question

I have just updated to v3, and I was following this doc https://github.com/doctrine/migrations/blob/master/UPGRADE.md#upgrade-to-30 in order to get my config updated.

However, if I try to run any of the console commands, now I get this error:

Fatal error: Uncaught RuntimeException: Configuration file "/.../cli-config.php" must return an instance of "Doctrine\Migrations\DependencyFactory"

This config file is shared with the rest of the doctrine tooling (dbal and orm), so changing it to return a DependencyFactory will make those tools no longer work.

Is there any way to make this file work with doctrine migrations 3, dbal and orm? If not, are you planning to provide some docs explaining how to work around it?

@goetas
Copy link
Member

goetas commented Jun 14, 2020

a list of BC breaks is available in https://github.com/doctrine/migrations/blob/master/UPGRADE.md

In your specific case, you should refer to this section of the documentation https://www.doctrine-project.org/projects/doctrine-migrations/en/latest/reference/configuration.html#advanced

@acelaya
Copy link
Author

acelaya commented Jun 14, 2020

That specific part of the docs only says that the cli-config.php file has to return a DependencyFactory object, but as I said, that would break doctrine dbal and orm in projects which use those together with migrations.

So my question is not how to solve that error, but how to get all three dbal, orm and migrations CLI tools work together, while they try to consume the same config file but expect something different to be returned from it.

@goetas
Copy link
Member

goetas commented Jun 14, 2020

Hmm, that sounds like something that should be addressed somehow as it could be a common scenario

@goetas goetas added the Bug label Jun 14, 2020
@goetas goetas self-assigned this Jun 14, 2020
@goetas
Copy link
Member

goetas commented Jun 14, 2020

Can you share the content (or the relevant parts) of your cli-config.php file?

@goetas
Copy link
Member

goetas commented Jun 14, 2020

Can you please check if #989 solves your issue?

@acelaya
Copy link
Author

acelaya commented Jun 14, 2020

Hey @goetas, thanks for addressing this so quickly.

Yeah, on a first sight I would say that should solve the problem.

This is my cli-config file, currently https://github.com/shlinkio/shlink/blob/develop/config/cli-config.php

Basically it pulls off an EntityManager instance from a PSR-11 container and creates a HelperSet with it.

@goetas
Copy link
Member

goetas commented Jun 14, 2020

Ok, then will add tests, probably will be part of 3.0.1

@goetas
Copy link
Member

goetas commented Jun 19, 2020

Solved in #989

@goetas goetas closed this as completed Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants