Aunque el código de este tutorial utiliza Symfony 8, ¡todo lo comentado funciona en Symfony 7!
// composer.json
{
"require": {
"php": ">=8.4",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.6", // v4.6.0
"doctrine/dbal": "^4.4", // 4.4.3
"doctrine/doctrine-bundle": "^3.2", // 3.2.2
"doctrine/doctrine-migrations-bundle": "^3.7", // 3.7.0
"doctrine/orm": "^3.6", // 3.6.6
"knplabs/knp-time-bundle": "^2.5", // 2.5.0
"pagerfanta/doctrine-orm-adapter": "^4.8", // v4.8.0
"php-cs-fixer/shim": "^3.94", // v3.95.2
"phpdocumentor/reflection-docblock": "^5.6", // 5.6.7
"phpstan/phpdoc-parser": "^2.3", // 2.3.2
"stof/doctrine-extensions-bundle": "^1.15", // v1.15.3
"symfony/asset": "8.0.*", // v8.0.8
"symfony/asset-mapper": "8.0.*", // v8.0.11
"symfony/console": "8.0.*", // v8.0.11
"symfony/dotenv": "8.0.*", // v8.0.11
"symfony/flex": "^2.10", // v2.10.0
"symfony/form": "8.0.*", // v8.0.9
"symfony/framework-bundle": "8.0.*", // v8.0.11
"symfony/http-client": "8.0.*", // v8.0.9
"symfony/monolog-bundle": "^4.0", // v4.0.2
"symfony/property-access": "8.0.*", // v8.0.8
"symfony/property-info": "8.0.*", // v8.0.8
"symfony/runtime": "8.0.*", // v8.0.12
"symfony/security-bundle": "8.0.*", // v8.0.12
"symfony/security-csrf": "8.0.*", // v8.0.8
"symfony/serializer": "8.0.*", // v8.0.10
"symfony/stimulus-bundle": "^2.34", // v2.35.0
"symfony/twig-bundle": "8.0.*", // v8.0.8
"symfony/ux-turbo": "^2.34", // v2.35.0
"symfony/validator": "8.0.*", // v8.0.10
"symfony/yaml": "8.0.*", // v8.0.12
"symfonycasts/tailwind-bundle": "^0.12.0", // v0.12.0
"twig/extra-bundle": "^3.24", // v3.24.0
"twig/twig": "^3.24" // v3.26.0
},
"require-dev": {
"symfony/debug-bundle": "8.0.*", // v8.0.8
"symfony/maker-bundle": "^1.67", // v1.67.0
"symfony/stopwatch": "8.0.*", // v8.0.8
"symfony/web-profiler-bundle": "8.0.*", // v8.0.12
"zenstruck/foundry": "^2.9" // v2.10.1
}
}
5 Comments
I've followed all the steps in this chapter, but there's a problem: the only user created isn't being loaded into the User table. When I run
symfony console dbal:run-sql 'select * from user', I get:[OK] The query yielded an empty result set.If I use the DB Browser for SQLite tool and inspect the User table, it is indeed empty.
@Brontie
The chapter’s fixture user is created by Foundry, so an empty
usertable usually means the fixtures story never ran, not that Doctrine is broken. Run the story loader explicitly soAppStoryinsertspicard@enterprise.spaceinto the database:If the table is still empty after that, make sure you already ran the migration that creates the
usertable, because Foundry can’t insert into a table that doesn’t exist yet. A common gotcha here is checking the SQLite file in one place while Symfony is using a different database path, so verify you’re looking at the samevar/data.dbyour app is actually configured to use.Sources:
Hey @giorgiocba
This may sound silly, but did you load the fixtures?
symfony console foundry:load-fixturesIf you did, could you do it again and see if there were any errors or warnings?
Another thing to check is whether you're using Docker for the database and whether you have it installed locally. It may be the case that the CLI is using the Docker instance, but the web isn't.
Cheers!
What could have happened?
"Houston: no signs of life"
Start the conversation!