// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.5", // v4.5.0
"doctrine/dbal": "^3", // 3.9.4
"doctrine/doctrine-bundle": "^2.13", // 2.13.2
"doctrine/doctrine-migrations-bundle": "^3.3", // 3.4.0
"doctrine/orm": "^3.3", // 3.3.1
"knplabs/knp-time-bundle": "^2.2", // v2.4.0
"pagerfanta/doctrine-orm-adapter": "^4.7", // v4.7.1
"php-cs-fixer/shim": "^3.46", // v3.65.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.6.0
"phpstan/phpdoc-parser": "^1.25", // 1.33.0
"stof/doctrine-extensions-bundle": "^1.12", // v1.13.0
"symfony/asset": "7.1.*", // v7.1.6
"symfony/asset-mapper": "7.1.*", // v7.1.9
"symfony/console": "7.1.*", // v7.1.8
"symfony/dotenv": "7.1.*", // v7.1.9
"symfony/flex": "^2", // v2.4.7
"symfony/framework-bundle": "7.1.*", // v7.1.6
"symfony/http-client": "7.1.*", // v7.1.9
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/property-access": "7.1.*", // v7.1.6
"symfony/property-info": "7.1.*", // v7.1.9
"symfony/runtime": "7.1.*", // v7.1.7
"symfony/serializer": "7.1.*", // v7.1.9
"symfony/stimulus-bundle": "^2.13", // v2.22.0
"symfony/twig-bundle": "7.1.*", // v7.1.6
"symfony/ux-turbo": "^2.13", // v2.22.0
"symfony/yaml": "7.1.*", // v7.1.6
"symfonycasts/tailwind-bundle": "^0.7.1", // v0.7.1
"twig/extra-bundle": "^2.12|^3.0", // v3.16.0
"twig/twig": "^2.12|^3.0" // v3.16.0
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.6", // 3.7.1
"symfony/debug-bundle": "7.1.*", // v7.1.6
"symfony/maker-bundle": "^1.52", // v1.61.0
"symfony/stopwatch": "7.1.*", // v7.1.6
"symfony/web-profiler-bundle": "7.1.*", // v7.1.9
"zenstruck/foundry": "^2.2" // v2.3.1
}
}
13 Comments
It's not worked for me as well, to make it work I fixed
compose.override.yamlports toHey @Sviatoslav-B
Could you tell me what error were you having? In the tutorial code we use the "map to a random host port" format which works fine with the Symfony CLI
Cheers!
okay, got it working
this wasn't enough:
sudo apt install php8.3-fpm
sudo apt install php8.3-pgsql
sudo phpenmod -v 8.3 -s fpm pdo_pgsql pgsql
obviously, I had to restart the symfony server, because that is the one running web app
symfony server:stop
symfony server:start -d
Hey @Martin-C
Thanks for sharing and I'm glad you got it working. It's super weird that
findAll()worked but errored withcreateQuery()...it worked with findAll() because it was just a mock returning instances of Starship
new Starship(1, 'USS LeafyCruiser (NCC-0001)', 'Garden', 'Jean-Luc Pickles', StarshipStatusEnum::IN_PROGRESS, new \DateTimeImmutable('+1 day')),
etc...
Oohh, got it!
php -m | grep pdo
pdo_pgsql
pdo_sqlite
hmm, once I replace dummy findAll() method with real
$ships = $em->createQuery('SELECT s FROM App\Entity\Starship s')->getResult();
I get "An exception occurred in the driver: could not find driver"
How is this is supposed to be running? Docker ps returns only db container, but where is the php service configured?
Obviously, if I run CLI
symfony console doctrine:query:dql 'select s from App\Entity\Starship s'
everything's OK.
Is this example suppose to use any PHPStorm internal docker intepreter?
I solved it like this:
Edit php.ini file.
decommand these:
extension=bz2
extension=curl
extension=gd
extension=gettext
extension=mbstring
extension=exif
extension=mysqli
extension=pdo_mysql
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
I have the same problem. I think there was an update for symfony, after these tutorials were published. Did you managed to fix it by any mean?
Hey @Bart-V!
With the Symfony CLI, PHP is expected to be installed locally on your machine. Docker is only used for the "services" your app requires.
pdo_pgsqlis required for theDATABASE_URLwe're using in this course but isn't always installed by default. I looked at my Homebrew PHP installation and it looks like, for me, pgsql was compiled into PHP.If you got it working I guess it was available, just not enabled.
As a total failsafe, you can always switch your
DATABASE_URLto a DB driver you have available (like SQLite). There's nothing in this course that is Postgres specific. We just wanted to show how it works with SymfonyCLI.--Kevin
Got another solution.
With the first one (edit php.ini); everytime I tried the fixtures:load it kept mentioning:
But if you run the next command, the fixtures:load worked perfectly. Without mentioning the line above.
I found this, because of your mentioning the line
for me, pgsql was compiled into PHPThank you, Kevin!!
You're welcome!
Yeah, when PHP is installed via apt, you need to install pgsql with apt.
This conversation has spurred me to write a blog post about installing PHP natively on different operating systems. So, thank you too!
"Houston: no signs of life"
Start the conversation!