symfony - Symfony2 routing without prefix -
in symfony project, have :
- example.com/user/username => go user profile
- example.com/blog/theweathertoday => go dynamic page post blog
- example.com/whoarewe => static page defined in routig.yml
and implement :
- example.com/username => go user profile
- example.com/theweathertoday => go dynamic page post blog
- 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
Post a Comment