-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Doctrine DBAL 2.5 Breaks Symfony if DB Doesn't Exist #351
Comments
This seems because you're relying in the auto-detection of platform to be used. |
I'm glad you've found a solution! But I'm struggling to put that into code. Could you help me change the above |
http://symfony.com/doc/current/reference/configuration/doctrine.html Search for platform_service. |
I am surprised that installing a new copy of Symfony and running Please remember, I am using all of the Symfony Standard defaults. I have change nothing from the standard, so everything should just work. Symfony documentation doesn't say you need to create a custom http://symfony.com/doc/current/bundles/SensioGeneratorBundle/commands/generate_doctrine_entity.html |
@mattjanssen might be... I'm giving you a hand to address the issue right now. |
For know you can simply provide the version of the database server you are connecting to like this: doctrine:
dbal:
default_connection: default
connections:
default:
dbname: Symfony2
user: root
password: null
host: localhost
driver: pdo_mysql
server_version: 5.6 # your database server version here As a workaround until we find a solution. |
See http://www.doctrine-project.org/jira/browse/DBAL-1057 for the DBAL issue |
Thank you @deeky666, @guilhermeblanco and @stof for confirming the issue! I was afraid this would be another "me" issue that no one else was experiencing. Those get very frustrating. Can I close this one then? |
I will keep it opened for now, until we see whether Doctrine can improve this to avoid guessing too early. I will give more visibility to this issue (and hopefully avoid too many duplicates). |
Same for me @mattjanssen. |
@thundo you can keep using DoctrineBundle 1.3. DoctrineBundle itself is not related to this issue at all. |
This is a problem for us because we use an installer UI to configure the database. Because of DBAL 2.5, the installer fails out of the box since the database isn't configured yet. In the installer, we give the option to select what driver to use and thus can't use the server_version workaround. Reverting to DBAL 2.4 was the only way fix I saw but that's not going to be an option in the long run. |
@alanhartless we are still working on a solution. Until then if you cannot provide the |
2.4 also shows this error... And not 2.3 I haven't tested yet with the |
@Taluu this is error is related to DBAL >= 2.5. If you get a similar error it must be something different. |
Well, I can't create the database on 2.4, I have the error "the database doesn't exist". So it looks like the same error.... I can drop it if it exists, but that's all.
And the |
@Taluu I can see from your stack trace that you are actually using DBAL 2.5. Therefore it's the same issue, yes. |
Yes, just saw on the orm's composer that 2.5 is used with the orm on 2.4 (as I have only the orm specified in my composer). So it is indeed a 2.5 error then. My bad. |
Is there any progress on this issue ? I was really looking forward to DBAL 2.5 due to its support for |
I think requiring first-time Symfony Standard installers to figure out that they must manually set the So if parameters.yml.dist + ParameterHandler prompts them with a working default... 👍 👍 👍 |
Prompting: good Someone make it happen ;-) |
@Ocramius I did set the version, of course, but it took quite some time to figure out it's even needed, that's the reason I'm following this issue to begin with. :) |
FYI I tried to fix this in DBAL via doctrine/dbal#2671 now thanks to the comment by @soullivaneuh which inspired me for this approach. |
v0.30.7, nohook build Fixed a bug that could cause an ISE when some Entity was requested with ID===null Added database_version parameter to work around a DBAL issue (see doctrine/DoctrineBundle#351)
Handled in doctrine/dbal#2671 |
The script must be run from within the VM and will most likely fail because of this bug (doctrine/DoctrineBundle#351). However it contains all necessary commands in order to install the PDE application.
See: doctrine/DoctrineBundle#351 for more details about the problem.
See: doctrine/DoctrineBundle#351 for more details about the problem.
See: doctrine/DoctrineBundle#351 for more details about the problem.
See: doctrine/DoctrineBundle#351 for more details about the problem.
After updating to DBAL 2.5, Doctrine introduced
Doctrine\DBAL\Connection::detectDatabasePlatform()
which is different than 2.4. Now in 2.5, any time a repository is instantiated (not even used) by the DI, we get a PDOException if the DB doesn't already exist.Imagine trying to run
app/console doctrine:database:create
and getting a "Database doesn't exist!" error. Repositories as services are very common in most projects, so this is a huge issue.To illustrate quickly, create a fresh Symfony project, letting composer install the AcmeDemoBundle. Then, while trying to generate an entity, you'll get the PDOException.
The text was updated successfully, but these errors were encountered: