public function onSingleRequest(SingleRequestEvent $event)
 {
     if ($event->getCallback()) {
         return;
     }
     $singleRequest = $event->getSingleRequest();
     $service = $singleRequest->metadata->get('action');
     $method = $singleRequest->metadata->get('method');
     $callback = $this->serviceManager->get($service, $method);
     $arguments = $this->getArguments($singleRequest, $callback, $this->serviceManager->getParameters($service, $method));
     $event->setCallback($callback);
     $event->setArguments($arguments);
 }
 public function onSingleRequest(SingleRequestEvent $event)
 {
     if (false == $event->getCallback()) {
         return;
     }
     $singleRequest = $event->getSingleRequest();
     $service = $singleRequest->metadata->get('action');
     $method = $singleRequest->metadata->get('method');
     $formArgumentPosition = $this->getFormArgumentPosition($this->serviceManager->getParameters($service, $method));
     if (false !== $formArgumentPosition) {
         $arguments = $event->getArguments();
         $arguments[$formArgumentPosition] = new FormBag((array) $arguments[$formArgumentPosition]);
         $event->setArguments($arguments);
     }
 }