src/Leevel/Database/Select.php
protected function queryClass(array $data)
    {
        $className = $this->queryParams['as_class'];

        if (!class_exists($className)) {
            $e = sprintf('The class of query `%s` was not found.', $className);

            throw new InvalidArgumentException($e);
        }

        foreach ($data as $key => $tmp) {
            $data[$key] = new $className((array) $tmp, ...$this->queryParams['class_args']);
        }

        if (!$this->condition->getOption()['limitQuery']) {
            $data = reset($data) ?: new $className([], ...$this->queryParams['class_args']);
        } elseif ($this->queryParams['as_collection']) {
            $data = new Collection($data, [$className]);
        }

        return $data;
    }
protected function queryClass(array $data)
    {
        $className = $this->queryParams['as_class'];

        if (!class_exists($className)) {
            $e = sprintf('The class of query `%s` was not found.', $className);

            throw new InvalidArgumentException($e);
        }

        foreach ($data as $key => $tmp) {
            $data[$key] = new $className((array) $tmp, ...$this->queryParams['class_args']);
        }

        if (!$this->condition->getOption()['limitQuery']) {
            $data = reset($data) ?: new $className([], ...$this->queryParams['class_args']);
        } elseif ($this->queryParams['as_collection']) {
            $data = new Collection($data, [$className]);
        }

        return $data;
    }
以 class 返回结果.

@param array $data

@return mixed