src/Ease/SQL/Orm.php
public function getColumnsFromSQL($columnsList, $conditions = null,
                                      $orderBy = null, $indexBy = null,
                                      $limit = null)
    {
        $cc = $this->dblink->getColumnComma();
        if (($columnsList != '*') && !count($columnsList)) {
            throw new Exception('getColumnsFromSQL: Missing ColumnList');
        }

        if (is_int($conditions)) {
            $conditions = [$this->getKeyColumn() => $conditions];
        }

        $where = '';
        if (is_array($conditions) && count($conditions)) {
            $where = SQL::$whr.$this->dblink->prepSelect($conditions);
        } else {
            if (!is_null($conditions)) {
                $where = SQL::$whr.$conditions;
            }
        }

        if (is_array($indexBy)) {
            $indexBy = implode(',', $indexBy);
        }

        if ($orderBy) {
            if (is_array($orderBy) && count($indexBy)) {
                foreach ($orderBy as $oid => $oname) {
                    $orderBy[$oid] = "`$oname`";
                }
                $orderByCond = SQL::$ord.implode(',', $orderBy);
            } else {
                $orderByCond = SQL::$ord.$orderBy;
            }
        } else {
            $orderByCond = '';
        }

        if (intval($limit)) {
            $limitCond = SQL::$lmt.$limit;
        } else {
            $limitCond = '';
        }

        if (is_array($columnsList)) {
            foreach ($columnsList as $id => $column) {
                $columnsList[$id] = $cc.$column.$cc;
            }

            return $this->dblink->queryToArray(SQL::$sel.implode(',',
                        $columnsList).SQL::$frm.$cc.$this->myTable.$cc.' '.$where.$orderByCond.$limitCond,
                    $indexBy);
        } else {
            if (!strstr($columnsList, '*')) {
                $columnsList = $cc.$columnsList.$cc;
            }

            return $this->dblink->queryToArray(SQL::$sel.$columnsList.' FROM '.$cc.$this->myTable.$cc.' '.$where.$orderByCond.$limitCond,
                    $indexBy);
        }
    }
public function getColumnsFromSQL($columnsList, $conditions = null,
                                      $orderBy = null, $indexBy = null,
                                      $limit = null)
    {
        $cc = $this->dblink->getColumnComma();
        if (($columnsList != '*') && !count($columnsList)) {
            throw new Exception('getColumnsFromSQL: Missing ColumnList');
        }

        if (is_int($conditions)) {
            $conditions = [$this->getKeyColumn() => $conditions];
        }

        $where = '';
        if (is_array($conditions) && count($conditions)) {
            $where = SQL::$whr.$this->dblink->prepSelect($conditions);
        } else {
            if (!is_null($conditions)) {
                $where = SQL::$whr.$conditions;
            }
        }

        if (is_array($indexBy)) {
            $indexBy = implode(',', $indexBy);
        }

        if ($orderBy) {
            if (is_array($orderBy) && count($indexBy)) {
                foreach ($orderBy as $oid => $oname) {
                    $orderBy[$oid] = "`$oname`";
                }
                $orderByCond = SQL::$ord.implode(',', $orderBy);
            } else {
                $orderByCond = SQL::$ord.$orderBy;
            }
        } else {
            $orderByCond = '';
        }

        if (intval($limit)) {
            $limitCond = SQL::$lmt.$limit;
        } else {
            $limitCond = '';
        }

        if (is_array($columnsList)) {
            foreach ($columnsList as $id => $column) {
                $columnsList[$id] = $cc.$column.$cc;
            }

            return $this->dblink->queryToArray(SQL::$sel.implode(',',
                        $columnsList).SQL::$frm.$cc.$this->myTable.$cc.' '.$where.$orderByCond.$limitCond,
                    $indexBy);
        } else {
            if (!strstr($columnsList, '*')) {
                $columnsList = $cc.$columnsList.$cc;
            }

            return $this->dblink->queryToArray(SQL::$sel.$columnsList.' FROM '.$cc.$this->myTable.$cc.' '.$where.$orderByCond.$limitCond,
                    $indexBy);
        }
    }
Vrací z databáze sloupečky podle podmínek.

@param array            $columnsList seznam položek
@param array|int|string $conditions  pole podmínek nebo ID záznamu
@param array|string     $orderBy     třídit dle
@param string           $indexBy     klice vysledku naplnit hodnotou ze
sloupečku
@param int              $limit       maximální počet vrácených záznamů

@return array