Chapters
27 Chapters
|
2:45:18
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
24.
Doing Crazy things with Foundry & Fixtures
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^3.3", // v3.3.0
"composer/package-versions-deprecated": "^1.11", // 1.11.99.3
"doctrine/doctrine-bundle": "^2.1", // 2.4.2
"doctrine/doctrine-migrations-bundle": "^3.0", // 3.1.1
"doctrine/orm": "^2.7", // 2.9.5
"knplabs/knp-markdown-bundle": "^1.8", // 1.9.0
"knplabs/knp-time-bundle": "^1.11", // v1.16.1
"pagerfanta/doctrine-orm-adapter": "^3.3", // v3.3.0
"pagerfanta/twig": "^3.3", // v3.3.0
"sensio/framework-extra-bundle": "^6.0", // v6.2.1
"stof/doctrine-extensions-bundle": "^1.4", // v1.6.0
"symfony/asset": "5.3.*", // v5.3.4
"symfony/console": "5.3.*", // v5.3.7
"symfony/dotenv": "5.3.*", // v5.3.7
"symfony/flex": "^1.3.1", // v1.21.6
"symfony/framework-bundle": "5.3.*", // v5.3.7
"symfony/monolog-bundle": "^3.0", // v3.7.0
"symfony/runtime": "5.3.*", // v5.3.4
"symfony/stopwatch": "5.3.*", // v5.3.4
"symfony/twig-bundle": "5.3.*", // v5.3.4
"symfony/validator": "5.3.*", // v5.3.14
"symfony/webpack-encore-bundle": "^1.7", // v1.12.0
"symfony/yaml": "5.3.*", // v5.3.6
"twig/extra-bundle": "^2.12|^3.0", // v3.3.1
"twig/string-extra": "^3.3", // v3.3.1
"twig/twig": "^2.12|^3.0" // v3.3.2
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3", // 3.4.0
"symfony/debug-bundle": "5.3.*", // v5.3.4
"symfony/maker-bundle": "^1.15", // v1.33.0
"symfony/var-dumper": "5.3.*", // v5.3.7
"symfony/web-profiler-bundle": "5.3.*", // v5.3.5
"zenstruck/foundry": "^1.1" // v1.13.1
}
}
8 Comments
Either with the first solution or "The Simpler Solutions", I get this error :
<blockquote>[Semantical Error] line 0, col 58 near 'tag WHERE q.askedAt': Error: Class App\Entity\Question has no association named tags</blockquote>
in the Doctrine query :
<blockquote>Doctrine\ORM\Query\QueryException
in C:\xampp\htdocs\cauldron_overflow\vendor\doctrine\orm\lib\Doctrine\ORM\Query\QueryException.php (line 49)
</blockquote>
I checked my code many times but to no avail.
Maybe something is wrong in QuestionRepository.php :
Any idea?
Thanks....
Hey Nicolas,
Did you download the course code and start from start/ directory? Or are you applying changes on your personal project or a fresh Symfony version?
Looks like you have a bad mapping in your project, try to run "bin/console doctrine:schema:validate" first and check the output - does it have both OK or mapping is failed? If failed - try to double-check and fix your mapping and try that query one more time.
Cheers!
Thanks Victor,
I indeed downloaded the course and started from scratch - not from a previous course.
Everything was fine until now.
I ran "bin/console doctrine:schema:validate" and the output seems correct:
nicolas@MURCIA MINGW64 /c/xampp/htdocs/cauldron_overflow (master)
$ bin/console doctrine:schema:validate
Mapping
-------
[OK] The mapping files are correct.
Database
--------
[OK] The database schema is in sync with the mapping files.
Yours truly...
Hey Nicolas,
Please, make sure you have $tags property in the Question entity. It probably should be $questionTags property in the query, i.e. try:
I suppose it will work now. I just downloaded the course code and see that the property is named as "questionTags" instead of just "tags".
Cheers!
Hey Victor,
The right answer to my issue is in fact in the next Chapter (Chapter 25 - JOINing Across Multiple Relationships).
I tested the Frontend too soon, at the end of Chapter 24 - unlike what Ryan did.
I am so sorry for the disturbance, and you can delete my post which might not be very useful to other users.
Thank again for your help, quick and useful.
Hey Nicolas,
Ah, ok, glad you found the solution! And let's keep the thread, it might be still useful for others ;)
Cheers!
At about 1:58 in the video it should be:
"Normally when we use QuestionTagFactory, it creates a new Question object." not QuestionFactory
Hey Ralf,
The sentence "Normally when we use QuestionFactory, it creates a new Question object" is correct, we're talking about QuestionFactory in that sentence, not about QuestionTagFactory. QuestionTagFactory cannot create Question object because it creates QuestionTag object. You're probably misleaded because on the video the QuestionTagFactory text was selected, but we were talking about it in the previous sentence :)
Cheers!
"Houston: no signs of life"
Start the conversation!