// composer.json
{
"require": {
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.0", // v4.4.0
"doctrine/doctrine-bundle": "^2.7", // 2.11.1
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.3.0
"doctrine/orm": "^2.12", // 2.17.3
"knplabs/knp-time-bundle": "^2.2", // v2.2.0
"pagerfanta/doctrine-orm-adapter": "^4.0", // v4.2.0
"pagerfanta/twig": "^4.0", // v4.2.0
"stof/doctrine-extensions-bundle": "^1.7", // v1.10.1
"symfony/asset": "7.0.*", // v7.0.0
"symfony/asset-mapper": "7.0.*", // v7.0.2
"symfony/console": "7.0.*", // v7.0.2
"symfony/dotenv": "7.0.*", // v7.0.2
"symfony/flex": "^2", // v2.4.3
"symfony/framework-bundle": "7.0.*", // v7.0.2
"symfony/http-client": "7.0.*", // v7.0.2
"symfony/messenger": "7.0.*", // v7.0.1
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/runtime": "7.0.*", // v7.0.0
"symfony/scheduler": "7.0.*", // v7.0.0
"symfony/twig-bundle": "7.0.*", // v7.0.0
"symfony/ux-turbo": "^2.0", // v2.13.2
"symfony/yaml": "7.0.*", // v7.0.0
"twig/extra-bundle": "^2.12|^3.0", // v3.8.0
"twig/twig": "^2.12|^3.0" // v3.8.0
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.5.1
"symfony/debug-bundle": "7.0.*", // v7.0.0
"symfony/maker-bundle": "^1.41", // v1.52.0
"symfony/stopwatch": "7.0.*", // v7.0.0
"symfony/web-profiler-bundle": "7.0.*", // v7.0.2
"zenstruck/foundry": "^1.21" // v1.36.1
}
}
6 Comments
Can the "MapQueryParameter" be somehow used to fetching objects from the database, as EntityValueResolver?
Or is it only for int and string?
(https://symfony.com/doc/current/doctrine.html#automatically-fetching-objects-entityvalueresolver)
Hey Nataniel-Z,
No, the purpose of that MapQueryParameter is simpler - map parameters from the query. If you want to map something to the DB - you should use EntityValueResolver as you mentioned. I.e. those are 2 different things for 2 different purposes.
Cheers!
Just one question: why a 404 with
bananainstead of an integer.Here I would expect a 400 or 422.
Hey @Spomky ,
Good question. Well, I think 404 makes sense in that case because there is no route that handles that specific URL, we clearly say that the route should be with an integer value, if that's not an integer - there's a different route, i.e. that controller (action) does not handle that specific URL. But you may allow any value of course without type-hinting it to int, then you will be able to handle the custom logic inside the controller (action) and return a better response for your needs.
Cheers!
Hi,
After all, that's maybe the expected behavior.
Like in route /foo/{bar} if bar has not the expected type or corresponds to nothing known by the application.
/foo?bar=xxx should return a 404 in this case.
Many thanks for this nice course. Looking forward for the next one 🤙
Hey Spomky!
Yeah, I believe that's why it works so. That's kind of an edge case, but that's how global router logic works I think. But still, devs can control/workaround it if needed of course.
And thanks for the kind words about this course! :)
Cheers!
"Houston: no signs of life"
Start the conversation!