2

I am passing var argurmrnt to controller like this

return $this->redirect($this->generateUrl('user_profile', array('var' => $profile->getId())));

THis is my controller

/**


         * @Route("/profile", name="user_profile")
         * @Template()
         */
        public function ProfileAction($var)
        {
            $em = $this->getDoctrine()->getEntityManager();

But i keep getting error

Controller "xxxx\Controller\UserController::ProfileAction()" requires that you provide a value for the "$var" argument (because there is no default value or because there is a non optional argument after this one).

1 Answer 1

8

You forgot to add placeholder to your route, according to docs

    /**
     * @Route("/profile/{var}", name="user_profile")
     * @Template()
     */
    public function ProfileAction($var)
    {
        $em = $this->getDoctrine()->getEntityManager();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.