Chapters
18 Chapters
|
1:50:35
|
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!
This tutorial also works great for Symfony 6!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": "^7.3.0 || ^8.0.0",
"ext-ctype": "*",
"ext-iconv": "*",
"easycorp/easy-log-handler": "^1.0.7", // v1.0.9
"sensio/framework-extra-bundle": "^6.0", // v6.2.1
"symfony/asset": "5.0.*", // v5.0.11
"symfony/console": "5.0.*", // v5.0.11
"symfony/debug-bundle": "5.0.*", // v5.0.11
"symfony/dotenv": "5.0.*", // v5.0.11
"symfony/flex": "^1.3.1", // v1.21.6
"symfony/framework-bundle": "5.0.*", // v5.0.11
"symfony/monolog-bundle": "^3.0", // v3.5.0
"symfony/profiler-pack": "*", // v1.0.5
"symfony/routing": "5.1.*", // v5.1.11
"symfony/twig-pack": "^1.0", // v1.0.1
"symfony/var-dumper": "5.0.*", // v5.0.11
"symfony/webpack-encore-bundle": "^1.7", // v1.8.0
"symfony/yaml": "5.0.*" // v5.0.11
},
"require-dev": {
"symfony/profiler-pack": "^1.0" // v1.0.5
}
}
11 Comments
Hi, When I run bin/console router:match /comments/10/vote/up --method=POST
//dir Path: hanen@hanen-PC /d/symfony5/cauldron_overflow (master)
I got an error [ERROR] None of the routes match the path "C:/Users/hanen/Downloads/vendor/git-for-windows/comments/10/vote/up"
the issue is missing vendors libraries ?!!
I have the same problem. Seems like the Git Bash console I'm using is interpeting "/" as git-bash.exe location folder. Not sure how make it stop adding the "C:/Users/hanen/Downloads/vendor/git-for-windows" in front of the route. Seems like a Git Bash console thing. Works fine in cmd.exe
Hey guys,
Try to wrap that path in quotes! Probably single quotes may not work in windows, I suppose you need to wrap it in double quotes. But just in case, it's a good idea to try both, some quotes should work for you I think. So, basically you need to run the next command:
$ bin/console router:match "/comments/10/vote/up" --method=POST
This should do the trick. And thanks JoxTheFix for some ideas about why it may happen, it's clearer for me where the problem might be.
I hope this helps!
Cheers!
Hi, I'm getting the same error with git bash (MINGW64) and single or doubles quotes didn't help. As with Jox, with windows prompt it works. Thanks.
Hey Joao,
Thanks for confirming that JoxTheFox solution works for you.
Cheers!
@victor thanks :)))
Hey hanen
Let's double check a couple of things
1) Check that you have defined the route
/comments/{id}/vote/up. You can runbin/console debug:routerto see all your routes2) Check that you have a comment in your database with ID 10
Let me know if you still have problems. Cheers!
The problem comes from my route where I specify that I only want to run it in POST so I add methods={"POST", "GET"}
/**
* @Route("/comments/{id}/vote/{direction<up|down>}", methods={"POST", "GET"})
*/
Did Victor comment answered to your problem? If not, could you please check if you are importing the right Route class? It should be this one
Symfony\Component\Routing\Annotation\RouteI add double quotes and execute the command in the terminal..everything works fine:)
Hi everyone , Thanks for your reply :))).. there Actually I'm using cmder software package on Windows but when I go to terminal from phpstorm run command adding double quotes: php bin/console router:match "/comments/10/vote/up" --method=POST
looks like it should work fine
[OK] Route "app_comment_commentvote" matches
+--------------+-------------------------------------------------------------+
| Property | Value |
+--------------+-------------------------------------------------------------+
| Route Name | app_comment_commentvote |
| Path | /comments/{id}/vote/{direction} |
| Path Regex | #^/comments/(?P<id>[^/]++)/vote/(?P<direction>up|down)$#sDu |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | POST |
| Requirements | direction: up|down |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: App\Controller\CommentController::commentVote |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| | utf8: true |
+--------------+-------------------------------------------------------------+
"Houston: no signs of life"
Start the conversation!