/** * @Route("/test/{message}/{stepNumber}", name="datamap_test") */ public function testAction(Message $message, $stepNumber) { $steps = json_decode($message->getFlow(), true); if (!isset($steps[$stepNumber])) { throw new NotFoundHttpException(); } $step = $steps[$stepNumber]; $datamap = $this->getDoctrine()->getManager()->getRepository('VRAppBundle:Datamap')->findOneByName($step['Datamap']); if (!$datamap) { throw new NotFoundHttpException(); } $data = json_decode($message->getFlowMessage()); if ($message->getFlowName() == 'nne') { $data = $data[$stepNumber - 1]; } $map = new Map(json_decode($datamap->getMap(), true)); $dataMapper = new DataMapper(); $dataMapper->setMap($map); return $this->render('VRAppBundle:Datamap:test.html.twig', array('message' => json_encode($data, JSON_PRETTY_PRINT), 'datamap' => $datamap, 'output' => json_encode($dataMapper->map($data), JSON_PRETTY_PRINT))); }
public function testGetSetFlowMessage() { $message = new Message(); $this->assertNull($message->getFlowMessage()); $message->setFlowMessage('test1'); $this->assertNotNull($message->getFlowMessage()); }