RedBeanPHP\QueryWriter\AQueryWriter::queryRecord PHP Method

queryRecord() public method

See also: QueryWriter::queryRecord
public queryRecord ( $type, $conditions = [], $addSql = NULL, $bindings = [] )
    public function queryRecord($type, $conditions = array(), $addSql = NULL, $bindings = array())
    {
        $addSql = $this->glueSQLCondition($addSql, count($conditions) > 0 ? QueryWriter::C_GLUE_AND : NULL);
        $key = NULL;
        if ($this->flagUseCache) {
            $key = $this->getCacheKey(array($conditions, $addSql, $bindings, 'select'));
            if ($cached = $this->getCached($type, $key)) {
                return $cached;
            }
        }
        $table = $this->esc($type);
        $sqlFilterStr = '';
        if (count(self::$sqlFilters)) {
            $sqlFilterStr = $this->getSQLFilterSnippet($type);
        }
        $sql = $this->makeSQLFromConditions($conditions, $bindings, $addSql);
        $fieldSelection = self::$flagNarrowFieldMode ? "{$table}.*" : '*';
        $sql = "SELECT {$fieldSelection} {$sqlFilterStr} FROM {$table} {$sql} -- keep-cache";
        $rows = $this->adapter->get($sql, $bindings);
        if ($this->flagUseCache && $key) {
            $this->putResultInCache($type, $key, $rows);
        }
        return $rows;
    }