Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \routing.yml
- login:
- pattern: /login
- defaults: { _controller : MyAppBundle:Security:login }
- login_check:
- pattern: /login_check
- logout:
- pattern: /logout
- // SecurityController.php
- ...
- class SecurityController extends Controller{
- public function loginAction(){
- if($test_if_credentials_present){
- $response = $this->forward('login_check',
- array('_username' => $username, '_password' => $password);
- return $response;
- }
- }
- }
- php app/console router:debug login_check
- [router] Route "login_check"
- Name login_check
- Path /login_check
- Host ANY
- Scheme ANY
- Method ANY
- Class SymfonyComponentRoutingRoute
- Defaults
- Requirements NO CUSTOM
- Options compiler_class: SymfonyComponentRoutingRouteCompiler
- Path-Regex #^/login_check$#s
- $router = $this->get('router');
- $uri = $router->generate('login_check'); // /login_check
- $attributes = $router->match($uri);
- Array
- (
- [_controller] => AcmeFooBundleControllerLoginController::checkAction
- [_route] => login_check
- )
- return $this->forward($attributes['_controller'], array(
- '_username' => $username,
- '_password' => $password
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement