コード例 #1
0
 public function testResetGuids()
 {
     $message = new Message();
     $message->setFlow(json_encode([1 => array('Module' => 'Account', 'GUID' => 'guid-step-1', 'Datamap' => 'example_datamap', 'Status' => 'Done', 'ErrorID' => null), 2 => array('Module' => 'Opportunity', 'GUID' => 'guid-step-2', 'Datamap' => 'example_datamap', 'Status' => 'Error', 'ErrorID' => null), 3 => array('Module' => 'Opportunity', 'GUID' => 'guid-step-3', 'Datamap' => 'example_datamap', 'Status' => 'In progress', 'ErrorID' => null), 4 => array('Module' => 'Relation', 'GUID' => '', 'SourceModule' => 'Opportunities', 'DestinationModule' => 'Opportunities', 'SourceStep' => 1, 'DestinationStep' => 2, 'Status' => 'New', 'ErrorID' => null)]));
     $steps = json_decode($message->getFlow(), true);
     $this->assertEquals('guid-step-1', $steps[1]['GUID']);
     $message->resetGuids();
     $steps = json_decode($message->getFlow(), true);
     $this->assertEquals('', $steps[1]['GUID']);
     $this->assertEquals('', $steps[2]['GUID']);
     $this->assertEquals('', $steps[3]['GUID']);
     $this->assertEquals('', $steps[4]['GUID']);
 }
コード例 #2
0
 /**
  * @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)));
 }