-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Added more great Symfony 4.1 features #817
Conversation
@@ -39,7 +39,7 @@ class BlogController extends AbstractController | |||
/** | |||
* @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
@@ -130,7 +130,7 @@ public function show(Post $post): Response | |||
/** | |||
* 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
*/ | ||
private $fullName; | ||
|
||
/** | ||
* @var string | ||
* | ||
* @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: