protected function addOneDecorator()
    {
        $this->addDecorator(function ($result) {
            if (isset($result[0]) && !empty($this->className)) {
                if ($result[0] instanceof $this->className) {
                    return $result[0];
                }
                if (is_array($result[0])) {
                    return EntityHelper::arrayToEntity($result[0], $this->className);
                }
                throw new DbException('The result is not instanceof ' . $this->className);
            }

            if (isset($result[0]) && empty($this->join) && !empty($this->className)) {
                $tableName = $this->getTableName();

                return EntityHelper::formatRowByType($result[0], $tableName);
            }

            if (empty($result) && !empty($this->className)) {
                return null;
            }

            if (isset($result[0])) {
                return $result[0];
            }

            return $result;
        });
    }