/**
* Get data and set the out object
* @param array $p_params
* @param array $p_cols
*/
public function dispatchData($p_params = null, $p_cols = null)
{
if (is_null($this->_adapter)) {
throw new \Exception('No adapter');
}
$rows = array();
$rowHandler = $this->_rowHandler;
foreach ($theData = $this->_adapter->getData(is_null($p_params) ? $this->_params : $this->setParams($p_params)->_params, is_null($p_cols) ? $this->_cols : $this->setParams($p_cols)->_cols) as $index => $entity) {
$rows[] = !is_null($rowHandler) ? $rowHandler($entity, $index) : $entity;
}
$this->_outputObject->iTotalRecords = $this->_adapter->getCount();
$this->_outputObject->iTotalDisplayRecords = $this->_adapter->getCount($this->_params, $this->_cols);
$this->_outputObject->aaData = $rows;
return $this;
}