// 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
}
}
7 Comments
When I run make:entity I get an error : [ERROR] The file "src/Repository/StarshipRepository.php" can't be generated because it already exists.
I've used this from the start of the the exercises - what is the correct way to proceed?
Hey @alimack!
Ah, did you just carry the code over from https://symfonycasts.com/screencast/symfony-fundamentals?
For this course's code, behind the scenes, I moved the old
StartshipRepositoryfromsrc/Repositorytosrc/Model. You can do the same before running this command and that should fix the error.Let me know if that doesn't work!
--Kevin
Many thanks for getting back to me. I did start with the fundamentals course.
Would it be best to just download the new code?
I'll try this tomorrow, dinner beckons!
In general, yes - that's kind of our expectation. While it's mostly a continuation from the final step of the previous course, there are sometimes small changes like this.
why is it that the entity class allows for null values (at the php level) when during the make:entity process the columns were specified as not null?
Hey @Francisc,
This is a great question. The answer is validation. The current suggested way to add validation to entities is to define your constraints directly on your entity's properties. For the validation component to work correctly, these properties need to be
nullable.I admit, this is unfortunate. I dislike the possibility of my entities being in an "invalid state" (a state that, when persisted, gives a database error). The current workaround is to use a separate DTO object that contains your validation constraints. Once that is valid, map this to your entity. Then, you likely need a way to map your entity back to the DTO for doing entity edits. It gets cumbersome...
The good news is there's some efforts into making this easier. Symfony 7.3 added an Object Mapper component that helps with the DTO <-> Entity conversion.
I'm hoping sometime in the future, we can change the current recommendation.
--Kevin
why is there a disconnect between the database configs for column and their corresponding class properties?
"Houston: no signs of life"
Start the conversation!