SFSUser
SFSUser

Reputation: 13

Symfony 5.1 - An exception has been thrown during the rendering of a template ("The controller for URI "/_fragment" is not callable")

recently I update my symfony project (4.1) to 5.1, but my code throws an error when I try embed the controller in twig template:

An exception has been thrown during the rendering of a template ("The controller for URI "/_fragment" is not callable: Controller "SamAngularBundle:System:connectionInfo" does neither exist as service nor as class.").

But when I run the URL works fine: View screenshot

Controller code:

class SystemController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController  {
   /**
    * @Route("/angular/connection/info", name="url_angular_connection_info")
    */
   public function connectionInfoAction() {
       return $this->render("@SamAngular/System/connection_info.html.twig");
   }
}

Template code:

{# empty Twig template #}
<div class="template-foot">    
    {{render(controller('SamAngularBundle:System:connectionInfo'))}}
</div>

What's the problem?

Upvotes: 1

Views: 5323

Answers (1)

msg
msg

Reputation: 8171

The Bundle:controller:action syntax was deprecated in 4.1 and removed in 5.0. It's been replaced by the controller::action syntax.

The same syntax for templates was also dropped much earlier (referenced for completeness, you are already using the new template syntax).

Upvotes: 1

Related Questions