| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function execute(Action $action, $source = 'internal', array $changeSet = [], $virtual = false) |
||
| 37 | { |
||
| 38 | |||
| 39 | //TODO: Find and run executor here |
||
| 40 | |||
| 41 | $state = new ActionHistory(); |
||
| 42 | $state->setAction($action); |
||
| 43 | $state->setTime(new \DateTime()); |
||
| 44 | $state->setSource($source); |
||
| 45 | $state->setPerformed(!$virtual); |
||
| 46 | $state->setChangeSet(json_encode($changeSet)); |
||
| 47 | |||
| 48 | $device = $action->getDevice()->setState($changeSet); |
||
| 49 | |||
| 50 | $this->getDoctrine()->getManagerForClass('AppBundle:ActionHistory')->persist($state); |
||
| 51 | $this->getDoctrine()->getManagerForClass('AppBundle:Device')->persist($device); |
||
| 52 | |||
| 53 | $this->getDoctrine()->getManager()->flush(); |
||
| 54 | |||
| 55 | return $this; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |