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

[Doc] Schema creation with doctrine/orm < or > 2.6 #83

Closed
magnetik opened this issue Mar 19, 2019 · 4 comments · Fixed by #212
Closed

[Doc] Schema creation with doctrine/orm < or > 2.6 #83

magnetik opened this issue Mar 19, 2019 · 4 comments · Fixed by #212
Labels
internal Updates that won't affect the API

Comments

@magnetik
Copy link
Contributor

Hi,

The doc for 2.x states:

The Bundle will not automatically create your schema for you unless you use SQLite or use doctrine/orm < 2.6.

But a few lines later, the option to resolve it is: composer require doctrine/orm:^2.6

So this should be "The bundle will not automatically create your schema for you unless you use SQLite or doctrine/orm >= 2.6" ?

@magnetik
Copy link
Contributor Author

And I just tried with doctrine/orm 2.6.4, and the loadFixtures() fails with Unknown database error because it tries to select it as soon as the connection is started, so before the createDatgabaseIfNotExists() call of the bundle.

@alexislefebvre
Copy link
Collaborator

alexislefebvre commented Mar 19, 2019

Thanks for your test, so it worked with doctrine/orm 2.6.3?

doctrine/orm:^2.6 is already required in require-dev of composer.json of the 2.x branch, so internal tests use latest version while users can use an older one.

(using a lower ORM version may explain liip/LiipFunctionalTestBundle#470 and/or liip/LiipFunctionalTestBundle#423 and why I wasn't able to reproduce the errors, it needs further investigation)

@magnetik
Copy link
Contributor Author

My bad I was testing with doctrine 2.6.3.

BUT good news, I think I have it !

I was using a database URL with the database name inside (mysql://foobar@127.0.0.1:3306/bar).
The ORMDatabaseTools removes the dbname from the params but not from the URL, hence it's trying to do a connection to the database to create the database.

I'll see if I can come up with a not-so-bad PR.

@magnetik
Copy link
Contributor Author

Well I'm not that clever.

Maybe we can just remove the path of the URL with some parse_url, but I fear that this would lead to some breakage with sqlite.

It seems very dirty to try to handle the URL has good as doctrine DriverManager does, and all it's methods are private so we cannot really rely on it.

Maybe we can just issue a warning stating that the URL should not be used?

@magnetik magnetik changed the title [Doc] Schema screation with doctrine/orm < or > 2.6 [Doc] Schema creation with doctrine/orm < or > 2.6 Feb 4, 2020
@alexislefebvre alexislefebvre transferred this issue from liip/LiipFunctionalTestBundle Jan 13, 2021
alexislefebvre added a commit to alexislefebvre/LiipTestFixturesBundle that referenced this issue Oct 4, 2022
alexislefebvre added a commit that referenced this issue Oct 4, 2022
…bout-doctrine/orm-version

gh-83: fix documentation about version of doctrine/orm
@alexislefebvre alexislefebvre added the internal Updates that won't affect the API label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Updates that won't affect the API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants