-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Added more great Symfony 4.1 features #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* @Route("/", defaults={"page": "1", "_format"="html"}, methods={"GET"}, name="blog_index") | ||
* @Route("/rss.xml", defaults={"page": "1", "_format"="xml"}, methods={"GET"}, name="blog_rss") | ||
* @Route("/page/{page}", defaults={"_format"="html"}, requirements={"page": "[1-9]\d*"}, methods={"GET"}, name="blog_index_paginated") | ||
* @Route("/page/{page<[1-9]\d*>}", defaults={"_format"="html"}, methods={"GET"}, name="blog_index_paginated") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would even change it to \d*+
. Using possessive quantifiers in routing requirements makes matching faster
* Displays a form to edit an existing Post entity. | ||
* | ||
* @Route("/{id}/edit", requirements={"id": "\d+"}, methods={"GET", "POST"}, name="admin_post_edit") | ||
* @Route("/{id<\d+>}/edit",methods={"GET", "POST"}, name="admin_post_edit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using a possessive quantifier here (\d++
), to improve the route matching performance (Symfony generates possessive quantifiers for its builtin requirements, but custom ones need to do that themselves, as using non-possessive quantifiers can still be a valid use case)
src/Entity/User.php
Outdated
* | ||
* @ORM\Column(type="string", unique=true) | ||
* @Assert\NotBlank() | ||
* @Assert\Length(min = 2, max = 50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing annotations are not putting spaces around the =
The last remaining big features are: