2

I have been creating a table from mysql result , but its printing the html markup only and says controller must return a response . what may be the reason ?

LogicException: The controller must return a response (

(5 rows)group_nameparent_nameEditDeleteSelect itemsL2V9http://192.168.1.236/mailusers/usergroup/edit/6>edithttp://192.168.1.236/mailusers/usergroup/delete/6>delete

L3v3http://192.168.1.236/mailusers/usergroup/edit/7>edithttp://192.168.1.236/mailusers/usergroup/delete/7>deleteAdminsV6http://192.168.1.236/mailusers/usergroup/edit/8>edithttp://192.168.1.236/mailusers/usergroup/delete/8>deleteL4Vodafonehttp://192.168.1.236/mailusers/usergroup/edit/9>edithttp://192.168.1.236/mailusers/usergroup/delete/9>deleteVCNONetworkhttp://192.168.1.236/mailusers/usergroup/edit/12>edithttp://192.168.1.236/mailusers/usergroup/delete/12>delete
given). in Symfony\Component\HttpKernel\HttpKernel->handleRaw() (line 157 of vendor/symfony/http-kernel/HttpKernel.php).

7

The error message is not pointing in the right direction. It should say:

"The controller must return a render array"

For example the most basic one:

return array(
  '#markup' => '<p>This is html markup</p>',
);

The error message is from symfony, and from the stand point of symfony this is correct. A controller must provide a response, but drupal has extended the response handling to look for render arrays, that are then used the generate a response with the rendered html. If you don't provide a render array, then there is no response and then this error message will come up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.