src/FelixOnline/Base/BaseDB.php
protected function getValues($fields, $preCalculatedResult = false)
    {
        if ($preCalculatedResult) {
            return $preCalculatedResult;
        }

        $app = App::getInstance();

        $sql = $this->constructSelectSQL($fields);

        // get cache
        $item = $this->getCache($fields[$this->pk]);
        $results = $item->get(\Stash\Invalidation::PRECOMPUTE, 300);

        if ($item->isMiss()) {
            $results = $this->runGetRow($sql);

            if ($app['db']->last_error) {
                throw new SQLException(
                    $app['db']->last_error,
                    $app['db']->captured_errors
                );
            }

            if (is_null($results)) {
                throw new ModelNotFoundException(
                    'No model in database',
                    $this->dbtable,
                    $this->constructorId
                );
            }

            $app['cache']->save($item->set($results));
        }

        return $results;
    }
protected function getValues($fields, $preCalculatedResult = false)
    {
        if ($preCalculatedResult) {
            return $preCalculatedResult;
        }

        $app = App::getInstance();

        $sql = $this->constructSelectSQL($fields);

        // get cache
        $item = $this->getCache($fields[$this->pk]);
        $results = $item->get(\Stash\Invalidation::PRECOMPUTE, 300);

        if ($item->isMiss()) {
            $results = $this->runGetRow($sql);

            if ($app['db']->last_error) {
                throw new SQLException(
                    $app['db']->last_error,
                    $app['db']->captured_errors
                );
            }

            if (is_null($results)) {
                throw new ModelNotFoundException(
                    'No model in database',
                    $this->dbtable,
                    $this->constructorId
                );
            }

            $app['cache']->save($item->set($results));
        }

        return $results;
    }
Query database and return results