src/orm/classes/Table.php
public function createSelectQuery($fill = true)
    {
        $q = Eresus_DB::getHandler()->createSelectQuery();
        if ($fill)
        {
            $columns = $this->getColumns();

            $select = array($this->getName() . '.*');
            foreach ($columns as $column)
            {
                $select = $column->onSelect($q, $select);
            }
            $q->selectDistinct($select);

            $q->from($this->getName());
            foreach ($columns as $column)
            {
                $column->onFrom($q);
            }
            if (count($this->getOrdering()) > 0)
            {
                foreach ($this->getOrdering() as $orderBy)
                {
                    $q->orderBy($orderBy[0], $orderBy[1]);
                }
            }
        }
        else
        {
            $q->from($this->getName());
        }
        return $q;
    }
public function createSelectQuery($fill = true)
    {
        $q = Eresus_DB::getHandler()->createSelectQuery();
        if ($fill)
        {
            $columns = $this->getColumns();

            $select = array($this->getName() . '.*');
            foreach ($columns as $column)
            {
                $select = $column->onSelect($q, $select);
            }
            $q->selectDistinct($select);

            $q->from($this->getName());
            foreach ($columns as $column)
            {
                $column->onFrom($q);
            }
            if (count($this->getOrdering()) > 0)
            {
                foreach ($this->getOrdering() as $orderBy)
                {
                    $q->orderBy($orderBy[0], $orderBy[1]);
                }
            }
        }
        else
        {
            $q->from($this->getName());
        }
        return $q;
    }
Возвращает заготовку запроса SELECT

@param bool $fill  заполнить запрос начальными данными

@return ezcQuerySelect

@since 1.00