Drivers\Abstraction\Sql::getOne PHP Method

getOne() public method

Previously called get_row.
public getOne ( $table = false, $where = [], $fields = [], $returnType = false ) : object
return object
    public function getOne($table = false, $where = array(), $fields = array(), $returnType = false)
    {
        if (!$table) {
            $row = $this->row($this->command());
            $this->returnType = 'object';
            return $row;
        }
        if ($returnType) {
            $this->returnType = $returnType;
        }
        $column = '*';
        if (!empty($fields)) {
            $column = $fields;
        }
        $this->select($column)->from($table);
        if (!empty($where)) {
            foreach ($where as $key => $val) {
                $this->where($key, '=', $val, 'AND');
            }
        }
        return $this->getOne();
    }