A
A
anboo2016-02-23 15:45:04
symfony
anboo, 2016-02-23 15:45:04

Controller is not called?

Controller "Backend\ChatBundle\Controller\ChatController::indexAction" for URI "/chat/id1222" is not callable.
routing.yml:

backend_chat:
    resource: "@BackendChatBundle/Controller/"
    type:     annotation
    prefix: /chat

ChatController:
/**
 * Class ChatController
 * @package Backend\ChatBundle\Controller
 */
class ChatController extends BaseController
{
    /**
     * @Route("/id{id}", requirements={"id": "\d+"}, name="backend_chat_chat_index")
     * @Security("user.id == room.getRecipient().getId() || user.id == room.getAuthor().getId()")
     */
    public function indexAction(Room $room)
    {
        return $this->render('BackendChatBundle:Default:index.html.twig');
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sukherev, 2016-02-23
@kropotor

You are passing a numeric value to a function that expects a Room class as a parameter.
Change Room $room to $id.
public function indexAction($id)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question