// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.5", // v4.5.0
"doctrine/dbal": "^3", // 3.10.3
"doctrine/doctrine-bundle": "^2.13", // 2.18.0
"doctrine/doctrine-migrations-bundle": "^3.3", // 3.5.0
"doctrine/orm": "^3.3", // 3.5.3
"knplabs/knp-time-bundle": "^2.2", // v2.4.0
"pagerfanta/doctrine-orm-adapter": "^4.7", // v4.7.2
"php-cs-fixer/shim": "^3.46", // v3.89.1
"phpdocumentor/reflection-docblock": "^5.3", // 5.6.3
"phpstan/phpdoc-parser": "^2.0", // 2.3.0
"stof/doctrine-extensions-bundle": "^1.12", // v1.14.0
"symfony/asset": "7.3.*", // v7.3.0
"symfony/asset-mapper": "7.3.*", // v7.3.5
"symfony/console": "7.3.*", // v7.3.5
"symfony/dotenv": "7.3.*", // v7.3.2
"symfony/flex": "^2", // v2.9.0
"symfony/form": "7.3.*", // v7.3.5
"symfony/framework-bundle": "7.3.*", // v7.3.5
"symfony/http-client": "7.3.*", // v7.3.4
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/property-access": "7.3.*", // v7.3.3
"symfony/property-info": "7.3.*", // v7.3.5
"symfony/runtime": "7.3.*", // v7.3.4
"symfony/security-csrf": "7.3.*", // v7.3.0
"symfony/serializer": "7.3.*", // v7.3.5
"symfony/stimulus-bundle": "^2.13", // v2.31.0
"symfony/twig-bundle": "7.3.*", // v7.3.4
"symfony/ux-turbo": "^2.13", // v2.31.0
"symfony/validator": "7.3.*", // v7.3.6
"symfony/yaml": "7.3.*", // v7.3.5
"symfonycasts/tailwind-bundle": "^0.9.0", // v0.9.0
"twig/extra-bundle": "^2.12|^3.0", // v3.22.0
"twig/twig": "^2.12|^3.0" // v3.22.0
},
"require-dev": {
"symfony/debug-bundle": "7.3.*", // v7.3.5
"symfony/maker-bundle": "^1.52", // v1.64.0
"symfony/stopwatch": "7.3.*", // v7.3.0
"symfony/web-profiler-bundle": "7.3.*", // v7.3.5
"zenstruck/foundry": "^2.7" // v2.7.7
}
}
5 Comments
Hello, I have setup the project from the start directory files and as per indicated in the readme. I have recreated the database and tables in MySQL (I am using MAMP PRO). I started the symfony server. When I try to access the homepage I have the following exception:
Any idea on how to solve this?
Hey @TiCatoune,
Yeah, that's a classic issue with MySQL. There are 2 options you have:
only_full_group_by, so you can just disable it in your MySQL config. Find yourmy.cnfand remove thatONLY_FULL_GROUP_BYfrom thesql_mode = "....."line. You will also need to restart MySQL for the change to take effect.Rewrite the query. I think the easiest would be to replace
StarshipRepository::findIncompleteOrderedByDroidCount()method with:The subquery there should do the trick, but this query may cause performance issues. Though it's not important for learning purposes, so should be totally fine as well.
Let me know if you have any other problems with the project.
Cheers!
Thank you for the course!
I have one concern though, both the course and the official docs seem to heavily steer people into binding their Forms to actual domain entities without a second thought. I think that approach works for small apps with somewhat anemic entities and simple flows. But it leads to worse design and worse testability, I think. The code now relies on the Form framework for entity validation, which makes testing more difficult (unit tests can't test invariants now) and is prone to issues down the road (what if you start creating the entities from a 3rdparty integration and forget to explicitly call the validator?).
I see this point was somewhat addressed in the older Symfony 4 Forms course and I think this is really worth mentioning. Ideally, if there is a resource for "Symfony Forms best practices for serious applications", link there?
Hey @melkamar!
I agree with you 100%. Traditionally, the reason this hasn't been shown as a best practice because of all the extra code and concepts needed. For beginners, it can be overwhelming: an entity, DTO, form type, DTO <-> Entity transformer...
Luckily, there has been some improvements recently.
symfony/object-mappermostly removes the need for a custom transformer. There's also a proposal to add both validation and form mapping to a DTO.Another thing that irks me about the current approach is the need for your entity properties always be nullable (even if they aren't so in the db).
My plan is to do a small, more advanced, micro-course on this specifically. Basically how to modify the code in this course to what you describe. Keep an eye out for that!
--Kevin
I forgot to mention the need for nullable properties - that was the biggest eyebrow raise when I started looking into this!
Thank you for the context around this topic, looking forward to the microcourse!
"Houston: no signs of life"
Start the conversation!