/** * @param \JSDataTables\Entity\ConfigDt $dtConfig * @param \JSDataTables\Entity\AjaxParams $ajaxParams */ public function createList(ConfigDt $dtConfig, AjaxParams $ajaxParams) { foreach ($ajaxParams->getColumns() as $column) { $server = $this->findColumnSearch($dtConfig, $column); if ($server) { $this->createClause($server->getField()['alias'], $server->getField()['name'], $server->getFilters(), $column->getSearch()->getValue(), $ajaxParams->getSearch()->getValue(), $server->getSeparator()); } } }
/** * @return \Doctrine\ORM\Query\Expr\OrderBy */ public function generateOrderBy(ConfigDt $dtConfig, AjaxParams $ajaxParams) { foreach ($ajaxParams->getOrder() as $order) { $index = $order->getColumn(); $column = isset($ajaxParams->getColumns()[$index]) ? $ajaxParams->getColumns()[$index] : null; $dtColumn = $dtConfig->getColumn($column->getData()); if ($column && $column->isOrderable() && $dtColumn) { $name = $dtColumn->getServer()->getField()['name']; $alias = $dtColumn->getServer()->getField()['alias']; $this->add($alias . self::$point . $name, $order->getDir()); } } return $this; }
/** * @return string */ public static function getSelect(ConfigDt $dtConfig, AjaxParams $ajaxParams) { $selectNew = []; $partials = []; foreach ($ajaxParams->getColumns() as $column) { $dtColumn = $dtConfig->getColumn($column->getData()); //$column->isSearchable() && $dtColumn if ($dtColumn) { $field = $dtColumn->getServer()->getField(); $name = $field['name']; $alias = $field['alias']; if (isset($field['partial'])) { $partials[$alias][] = $name; } else { $selectNew[] = $alias . self::$point . $name . (isset($field['alias_name']) ? " AS {$field['alias_name']}" : ''); } } } foreach ($partials as $key => $value) { $selectNew[] = "partial {$key}.{" . implode(',', $value) . "}"; } return implode(',', $selectNew); }