symfony - Symfony2 routing without prefix -


in symfony project, have :

  1. example.com/user/username => go user profile
  2. example.com/blog/theweathertoday => go dynamic page post blog
  3. example.com/whoarewe => static page defined in routig.yml

and implement :

  1. example.com/username => go user profile
  2. example.com/theweathertoday => go dynamic page post blog
  3. example.com/whoarewe => static page

could tell me best way :

  • separate user blog article site pages ? (controller, service, ... ?)
  • how make sure user not register restricted name, "whoarewe" wich defined in routing.yml ?

what best approach ?

the routing.yml file 1 way load routes, there many other ways. 1 way, may need, custom route loader.

since route loaders defined services, can inject other services them, such username checker can re-used part of application validates new user registration.

absent of doing this, you'd need route traffic matches ^/[^/]+ sort of intermediary front-controller take matched parameter , decide how forward it.

the full answer question going decent amount of work, gets started in right direction.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -