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
Connection to the database is triggered #292
Comments
Hi! I might be completely wrong here, but it's worth a shot. I had a similar issue with Doctrine connecting to MariaDB, when I wasn't doing any queries at all. The problem is that Doctrine needs to know what version of the DB server it is working with in order to instantiate the correct To turn off this auto-detection, you can specify this information in advance, like so:
|
@jlherren You were right, it was caused by the serverVersion, I added it and I no longer have the error. Since i'm using an url I added it on my url:
$params = [
'url' => $database_url,
]; |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm not sure i should post here, let me know if it's not the right place.
I am using
phpstan
1.4 andphpstan-doctrine
1.2.When i run phpstan
vendor/bin/phpstan analyze
it appears that phpstan is trying to connect to the database, but it's not accessible.I know that it's when there is a getRepository because when i comment it i don't have the error.
I ran phpstan with the
--debug
flag, i have 3 lines that are about phpstan-doctrine, the rest is inside phpstan files or doctrine files.If i look at
src/Type/Doctrine/ObjectMetadataResolver.php
line 131phpstan-doctrine/src/Type/Doctrine/ObjectMetadataResolver.php
Lines 122 to 135 in 5a5454c
the
$metadata = $objectManager->getClassMetadata($className);
is triggering the connection.I tried to remove the condition and always do the if part:
With that changes i don't have the error anymore, but i don't know exactly what was the purpose of that line.
Does phpstan need to connect to the database ? What do you think about this ?
The text was updated successfully, but these errors were encountered: