Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Added more great Symfony 4.1 features #817

wants to merge 6 commits into from

Conversation

javiereguiluz
Copy link
Member

The last remaining big features are:

@@ -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")
Copy link
Member

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")
Copy link
Member

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)

*/
private $fullName;

/**
* @var string
*
* @ORM\Column(type="string", unique=true)
* @Assert\NotBlank()
* @Assert\Length(min = 2, max = 50)
Copy link
Member

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 =

@javiereguiluz
Copy link
Member Author

@stof I've merged without making the changes in the routing requirements ... but I've opened #818 to discuss about your proposal. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants