/** * @return Compatible\CDBResult|int */ public function execute() { /** @var Compatible\CDBResult $result */ $result = new Compatible\CDBResult(); $this->query->prepare($this->sort, $this->filter, $this->group, $this->select); if ($this->query->counted()) { return $this->query->exec()->getSelectedRowsCount(); } return $this->query->compatibleExec($result, $this->nav); }
public static function adaptResult(Compatible\CDBResult $result, Compatible\OrderQuery $query, $taskIdName) { if (!($query->grouped() || $query->aggregated())) { $select = $query->allSelected() ? self::permissions() : array_intersect_key(self::permissions(), $query->getSelect()); if ($select) { $query->setSelect(array_diff_key($query->getSelect(), $select)); $query->addAlias('TASK_ID', $taskIdName); $query->addAliasSelect('TASK_ID'); $result->addFetchAdapter(new self($select)); } } }
function __construct(OrderQuery $query, array $select) { $this->select = $query->getSelectNamesAssoc() + array_flip($select); if (!$query->aggregated()) { $query->addAliasSelect('TYPE'); $query->addAliasSelect('SETTINGS'); $query->addAliasSelect('MULTIPLE'); $query->registerRuntimeField('PROPERTY_ID', new Entity\ExpressionField('PROPERTY_ID', 'DISTINCT(%s)', 'ID')); $sel = $query->getSelect(); array_unshift($sel, 'PROPERTY_ID'); $query->setSelect($sel); } }
/** * @return Compatible\CDBResult */ public function execute() { $this->query->prepare($this->sort, $this->filter, $this->group, $this->select); $result = new Compatible\CDBResult(); return $this->query->compatibleExec($result, $this->nav); }