ChatController.php 1.04 KB
Newer Older
Mat's avatar
Mat committed
1 2 3 4 5 6
<?php

namespace SocketBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
Mat's avatar
Mat committed
7
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
Mat's avatar
Mat committed
8 9 10

class ChatController extends Controller
{
Mat's avatar
Mat committed
11
 
12 13
         //  on peut mettre ça aussi dans les annotations
         //  * @Security("has_role('ROLE_ADMIN')")
Mat's avatar
Mat committed
14

Mat's avatar
Mat committed
15
    /**
16
     * @Route(name="chat_message", path="/socket/chat")
Mat's avatar
Mat committed
17 18 19
     */
    public function messageAction()
    {
Mat's avatar
Mat committed
20 21
        
        return $this->render('@Socket/Chat/message.html.twig');
Mat's avatar
Mat committed
22
    }
Mat's avatar
Mat committed
23
    
24
    
Mat's avatar
Mat committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
    /**
     * @Route(name="login", path="/login")
     * @param AuthenticationUtils $utils
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function loginAction(AuthenticationUtils $utils)
    {
        $username = $utils->getLastUsername();
        $error = $utils->getLastAuthenticationError();
        return $this->render('@Socket/Login/login.html.twig', array(
           'username' => $username,
           'error' => $error
        ));
    }
    
Mat's avatar
Mat committed
40
}