/**
  * Gets the ajax data.
  *
  * @param Request                          $request
  * @param AjaxChoiceLoaderInterface        $choiceLoader
  * @param AjaxChoiceListFormatterInterface $formatter
  * @param string                           $prefix
  *
  * @return array
  */
 public static function getData(Request $request, AjaxChoiceLoaderInterface $choiceLoader, AjaxChoiceListFormatterInterface $formatter, $prefix = '')
 {
     $ajaxIds = $request->get($prefix . 'ids', '');
     if (is_string($ajaxIds) && '' !== $ajaxIds) {
         $ajaxIds = explode(',', $ajaxIds);
     } elseif (!is_array($ajaxIds) || in_array($ajaxIds, array(null, ''))) {
         $ajaxIds = array();
     }
     $choiceLoader->setPageSize(intval($request->get($prefix . 'ps', $choiceLoader->getPageSize())));
     $choiceLoader->setPageNumber(intval($request->get($prefix . 'pn', $choiceLoader->getPageNumber())));
     $choiceLoader->setSearch($request->get($prefix . 's', ''));
     $choiceLoader->setIds($ajaxIds);
     $choiceLoader->reset();
     return $formatter->formatResponseData($choiceLoader);
 }