Hello World!
I got two Controllers: JsonController and MapController.
In the JsonController I got a public function namend "getJson($param,$id)". This functions calls other private function, depending on the $param.
My MapController needs information about some planets, so I use
$jsonController = new \Pegasus2540\Frontend\Controllers\JsonController();
$json = $jsonController->getJson("planets", 1);
in the showAction() of my MapController to get the information.
My getJson() function looks like this
public function getJSON($param, $id) {
echo "You would like to get: ".$param."-".$id;
switch ($param) {
case("planets"):
$data = $this->getPlanets($id);
break;
case("solarsystem"):
$data = $this->getSolarsystem($id);
break;
default:
break;
}
echo json_encode($data);
return json_encode($data);
}
Now, when I call the map in my browser, I expect something like "You would like to get planets-1" and my json.
But it seems like it doenst work. No echo, no json.