Bendy
Bendy

Reputation: 3576

Flexibility of Symfony annotations

I use annotations for stand Symfony routes such as...

/**
 * @Route("/", name="homepage")
 */

...quite happily, however I would have liked/expected some flexibility with the comments to be able to make each new route more visually identifiable - for example:

/********************************************************************
 * @Route("/", name="homepage")
 ********************************************************************/

However, when I try this, I get an error:

No route found for "GET /"

Is there a way the *s (or #s can be extended such as above? (or is there a strong reason for not being able to do this?)

Upvotes: 1

Views: 46

Answers (1)

BentCoder
BentCoder

Reputation: 12730

I don't know why you cannot use /************ but I think one of these would be good enough for your purpose. I think 1st one looks better, at least to me!

/**
 * ***********************************
 * @param Request $request
 *
 * @Route("")
 * @Method({"POST"})
 *
 * @throws Exception
 * ***********************************
 */

/** ***********************************
 * @param Request $request
 *
 * @Route("")
 * @Method({"POST"})
 *
 * @throws Exception
 * ***********************************/

/** *******************************
 * @param Request $request
 *
 * @Route("")
 * @Method({"POST"})
 *
 * @throws Exception
 ** ******************************/

Upvotes: 1

Related Questions