0

I am a beginner in Symfony 2.8. I have a problem with my controller.

That is my controller:

class ExampleController extends ExtraController
{

    /**
     * @ParamConverter("site", class="Bundle:Site", converter="site_slug_converter")
     * @Route("/formacion-example", name="example_web.front.example_training", requirements={"site": "es"})
     *
     * Render the Example form page
     *
     * @param  Site $site
     *
     * @return  Response
     */
    public function example2TrainingFormAction(Site $site)
    {
        $options = ['site' => $site, 'projectId' => $this->get('example.doctrine.project_getter')->getProject()];
        $form = $this->createForm(ExampleTrainingType::class, null, $options);
        $viewData = ['form' => $form->createView()];

        return $this->render('ExampleFrontContactFormBundle:Example:example_training.html.twig', $viewData);
    }
}

When I go to my Route www.example.com/es/formacion-example symfony return to me:

HTTP status: Error 500

Controller: n/a

Route name:example_web.front.example_training

Has session: no

In symfony documentation I cant find a solution.

Thank you! :)

3
  • 1
    the error could be coming from missing the site from your route definition, i.e. could you try with @Route("/{site}/formacion-example", ... Commented Jul 29, 2016 at 9:16
  • Yeah is right I thought that the ParamConverter do it. Than you man! @ejuhjav Commented Jul 29, 2016 at 9:47
  • happy to help, added the same thing as an answer so that this can be marked as solved. Commented Jul 29, 2016 at 10:46

1 Answer 1

1

adding the answer here as well:

i.e. the site parameter was missing from the route

@Route("/{site}/formacion-example", ...
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.