/**
  * @param \FSi\Bundle\AdminBundle\Admin\CRUD\BatchElement $element
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @return array
  * @throws \FSi\Bundle\AdminBundle\Exception\ContextBuilderException
  */
 private function getObjects(BatchElement $element, Request $request)
 {
     $objects = array();
     $indexes = $request->request->get('indexes', array());
     if (!count($indexes)) {
         throw new RequestHandlerException('There must be at least one object to execute batch action');
     }
     foreach ($indexes as $index) {
         $object = $element->getDataIndexer()->getData($index);
         if (!isset($object)) {
             throw new RequestHandlerException(sprintf("Can't find object with id %s", $index));
         }
         $objects[] = $object;
     }
     return $objects;
 }
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\CRUD\BatchElement $element
  * @param \FSi\Bundle\AdminBundle\Admin\Context\ContextManager $manager
  * @param \Symfony\Component\HttpFoundation\Request $request
  */
 function it_throws_exception_when_cant_find_context_builder_that_supports_admin_element($element, $manager, $request)
 {
     $element->getId()->willReturn('admin_element_id');
     $manager->createContext(Argument::type('string'), $element)->shouldBeCalled()->willReturn(null);
     $this->shouldThrow('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException')->during('batchAction', array($element, $request));
 }