/**
  * @throws ApiProblem
  */
 public function bulkAction()
 {
     $data = $this->bodyParams();
     if (!is_array($data)) {
         $exception = new ApiProblem(500, 'Invalid body');
         return new JsonModel($exception->toArray());
     }
     $result = $this->bulkService->bulk($data);
     $response = new JsonModel($result);
     return $response;
 }
 /**
  * @param \Phpro\Apigility\Doctrine\Bulk\Service\BulkService $bulkService
  * @param \Phpro\Apigility\Doctrine\Bulk\Model\Result $result;
  */
 public function it_should_handle_bulk_actions($bulkService, $result)
 {
     $bulkService->bulk(Argument::any())->willReturn([$result]);
     $response = $this->bulkAction();
     $response->shouldBeAnInstanceOf('Zend\\View\\Model\\JsonModel');
     $response->getVariable(0)->shouldBe($result);
 }