Chapters
27 Chapters
|
3:13:54
|
Login to bookmark this video
-
Course Code
Login or register to download the code!
Login or register to download the code!
-
This Video
Login or register to download the video!
Login or register to download the video!
-
Subtitles
Login or register to download the subtitles!
Login or register to download the subtitles!
-
Course Script
Login or register to download the script!
Login or register to download the script!
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!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^3.7", // v3.7.0
"doctrine/doctrine-bundle": "^2.7", // 2.7.0
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.2
"doctrine/orm": "^2.13", // 2.13.3
"easycorp/easyadmin-bundle": "^4.4", // v4.4.1
"netgen/layouts-contentful": "^1.3", // 1.3.2
"netgen/layouts-standard": "^1.3", // 1.3.1
"pagerfanta/doctrine-orm-adapter": "^3.6",
"sensio/framework-extra-bundle": "^6.2", // v6.2.8
"stof/doctrine-extensions-bundle": "^1.7", // v1.7.0
"symfony/console": "5.4.*", // v5.4.14
"symfony/dotenv": "5.4.*", // v5.4.5
"symfony/flex": "^1.17|^2", // v2.2.3
"symfony/framework-bundle": "5.4.*", // v5.4.14
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/proxy-manager-bridge": "5.4.*", // v5.4.6
"symfony/runtime": "5.4.*", // v5.4.11
"symfony/security-bundle": "5.4.*", // v5.4.11
"symfony/twig-bundle": "5.4.*", // v5.4.8
"symfony/ux-live-component": "^2.x-dev", // 2.x-dev
"symfony/ux-twig-component": "^2.x-dev", // 2.x-dev
"symfony/validator": "5.4.*", // v5.4.14
"symfony/webpack-encore-bundle": "^1.15", // v1.16.0
"symfony/yaml": "5.4.*", // v5.4.14
"twig/extra-bundle": "^2.12|^3.0", // v3.4.0
"twig/twig": "^2.12|^3.0" // v3.4.3
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.2
"symfony/debug-bundle": "5.4.*", // v5.4.11
"symfony/maker-bundle": "^1.47", // v1.47.0
"symfony/stopwatch": "5.4.*", // v5.4.13
"symfony/web-profiler-bundle": "5.4.*", // v5.4.14
"zenstruck/foundry": "^1.22" // v1.22.1
}
}
9 Comments
Hey,
I am getting the same error "Query type handler for "latest_recipes" query type does not exist." even when I add into src/Layouts/LatestRecipeQueryTypeHandler.php:
and into config/packages/netgen_layouts.yaml:
I don't know what is the problem... I need help. :)
Hey @StjepanPetrovic!
Hmm. To debug, let's first ask our app to show us all of the services that have the
netgen_layouts.query_type_handlertag on it:In my app, I see something like this:
Do you see your service there? If not is your service being autowired (most are unless you have some special setup)? Does that
AutoconfigureTagclass exist in your app (I'm making sure your Symfony version is new enough for this).Cheers!
Hey @weaverryan, here I am!
When I run:
php bin/console debug:container --tag=netgen_layouts.query_type_handlerI got the same error:Query type handler for "latest_recipes" query type does not exist., so I don't see service here.Also, when I run:
php bin/console cache:clearI got the same error.I have taken your starting source code and I am following steps in order like in your tutorials - you can check my code on my Github.
AutoconfigureTag exists in my app - my Symfony version is 5.4.22 and Symfony CLI version is 5.5.2.
Hey @StjepanPetrovic!
Ah, my apologies - I see now that the error comes from during container compilation! So you're right that even the debugging tools won't work to help us :). You can try this instead:
A) Comment-out the
latest_recipesquery type. Then verify that runningbin/console cache:clearonce again works. We're temporarily removing the problem so that our debugging tools work.B) NOW try
php bin/console debug:container --tag=netgen_layouts.query_type_handler. Do you see your service in this list?You can also try running
php bin/console debug:container LatestRecipeQueryTypeHandler- that should find your service (we're not giving the full service name, but it should search and find your service). Do you see it? And does the service definition have any tags on it?Let me know!
Cheers!
Hey @weaverryan!
Somehow I got rid of that error... Here is the steps I did:
latest_recipesquery type. Everything was working now.php bin/console debug:container --tag=netgen_layouts.query_type_handlerbut I didn't saw my service in the list. Also I didn't find my servie withphp bin/console debug:container LatestRecipeQueryTypeHandlerlatest_recipesquery type. Expected, I was getting the error.and in src/Layouts/LatestRecipeQueryTypeHandler.php I commented-out this:
After adding this I was not getting the error, everything was working and when I clicked on Grid block I could chose between manual or dynamic collection.
and commenting-out:
aaaand in some reason everythink is working. I don't know what was the problem. :)
Haha, wow. That was very procedural to get that going! My best guess is that you had some phantom caching issue. When you create a new file/class, Symfony's container should notice the new class and rebuild the container so that the new class can be registered as a service. For some reason, I think that wasn't happening for you. By updating
services.yaml, that triggered a container rebuild... where it probably, finally, noticed your new class/service. So, later, when you re-added the#[AutoconfigureTag]attribute, now it saw that and applied it.Just a guess - I wouldn't worry too much about it - glad it's working!
Cheers!
Yes! Thank you!
Cheers!
Wow. Thanks to your lessons, I learn a lot about the Symfony itself. Some feature adds like year ago, but I didn't knew about.
#[AutoconfigureTag('netgen_layouts.query_type_handler', ['type' => 'latest_recipes'])]instead of:
Haha, I know, right? These features have been coming so fast and steady that it's hard to keep up (even for me, and it's my job). I LOVE
AutoconfigureTagCheers!
"Houston: no signs of life"
Start the conversation!