LazyRecord\BaseCollection::createReadQuery PHP Method

createReadQuery() public method

public createReadQuery ( )
    public function createReadQuery()
    {
        $dsId = $this->getSchema()->getReadSourceId();
        $conn = ConnectionManager::getInstance()->getConnection($dsId);
        $driver = $conn->createQueryDriver();
        $q = new SelectQuery();
        // Read from class consts
        $q->from($this->getTable(), $this->_alias);
        // main table alias
        if ($selection = $this->getSelected()) {
            $q->select($selection);
        } else {
            $q->select($this->explictSelect ? $this->getExplicitColumnSelect($driver) : $this->_alias . '.*');
        }
        // Setup Default Ordering.
        if (!empty($this->defaultOrdering)) {
            foreach ($this->defaultOrdering as $ordering) {
                $q->orderBy($ordering[0], $ordering[1]);
            }
        }
        return $q;
    }