protected function setCurrentRow($row)
    {
        if (!in_array($this->return_mode, [ConnectionInterface::RETURN_OBJECT_BY_CLASS, ConnectionInterface::RETURN_OBJECT_BY_FIELD], true)) {
            $this->current_row = $row;
            $this->getValueCaster()->castRowValues($this->current_row);

            return;
        }

        $class_name = $this->return_mode === ConnectionInterface::RETURN_OBJECT_BY_CLASS
            ? $this->return_class_or_field
            : $row[$this->return_class_or_field];

        if (empty($this->constructor_arguments)) {
            $this->current_row = new $class_name();
        } else {
            $this->current_row = (new ReflectionClass($class_name))->newInstanceArgs($this->constructor_arguments);
        }

        if ($this->current_row instanceof ContainerAccessInterface && $this->container) {
            $this->current_row->setContainer($this->container);
        }

        $this->current_row->loadFromRow($row);
    }