private function resolveOutputField()
    {
        if (is_null($this->outputField)) {
            $sourceFields = $this->getSourceFields();
            if (0 == count($sourceFields)) {
                $this->outputField = null;
            } else {
                foreach ($sourceFields as $sourceField) {
                    if (is_null($this->outputField)) {
                        $this->outputField = $sourceField;
                    }
                    if (!is_null($this->outputField) && !($this->outputField instanceof $sourceField)) {
                        throw new FieldError('Expression contains mixed types. You must set output_field');
                    }
                }
            }
        }
    }