protected function _getDataRelation($line, $foreign, $parent) {
        /** @var $entity \Gcs\Framework\Core\Orm\Entity\Entity */

        $class = $foreign->referenceEntity();
        $entity = self::Entity()->$class();

        if ($line[$foreign->field() . '_' . $entity->name() . '_' . $entity->primary()] != '') {
            foreach ($line as $key => $field) {
                $value = null;

                $key = str_replace($foreign->field() . '_' . $entity->name() . '_', '', $key);

                if ($entity->getField(str_replace($foreign->field() . '_' . $entity->name() . '_', '', $key)) != null) {
                    if (in_array($entity->getField(str_replace($foreign->field() . '_' . $entity->name() . '_', '', $key))->type, [Field::INCREMENT, Field::INT, Field::FLOAT, Field::TEXT, Field::STRING, Field::CHAR, Field::BOOL, Field::DATE, Field::DATETIME, Field::TIMESTAMP, Field::ENUM])) {
                        $value = $field;
                    }
                    else {
                        switch ($entity->getField(str_replace($foreign->field() . '_' . $entity->name() . '_', '', $key))->type) {
                            case Field::FILE :
                                $file = new File('', '', '', '');
                                $file->hydrate($field);
                                $value = $file;
                                break;
                        }
                    }

                    $fieldName = str_replace($foreign->field() . '_' . $entity->name() . '_', '', $key);
                    $entity->set($fieldName, $value);
                }
            }

            return $entity;
        }
        else {
            return null;
        }
    }