Get a relation link.
@param string $type
@return RelationLinkInterface
@throws RelationNotFoundException
175786
public function getRelation($type)
    {
        if (!isset($this->relations[$type])) {
            throw new RelationNotFoundException($type);
        }
        return $this->relations[$type];
    }
776757
public function getConnection(string $type = null): Connection
    {
        if ($type === null) {
            return $this->getDefaultConnection();
        }
        if (!$this->hasConnectionType($type)) {
            throw new ConnectionHandlerExceptionImpl('Connection not found for type: ' . $type);
        }

        return $this->connections[$type];
    }
454291
public function resolve($type, $id)
    {
        $instance = (new $type)->find($id);

        if ($instance) {
            return $instance;
        }

        throw new EntityNotFoundException($type, $id);
    }
1221058
public function actionIndex($type = 'product')
    {
        if (!is_product_type_name($type)) {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
        $searchModel = new TermOfProductTypeSearch();
        $queryParams = request()->queryParams;
        $queryParams['TermOfProductTypeSearch']['product_type'] = $type;
        $dataProvider = $searchModel->search($queryParams);

        return $this->render('index', [
            'searchModel'  => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
159762
public function getRelation($contentType = null)
    {
        if (!$this->relation instanceof Collection\Relations) {
            $this->relation = new Collection\Relations();
        }

        if ($contentType !== null) {
            return $this->relation[$contentType];
        }

        return $this->relation;
    }
1142619
protected function getRelationMappedMorphClass($type)
    {
        $map = Relation::morphMap();

        if (empty($map)) {
            return $type;
        }

        return array_get($map, $type, ltrim($type, '\\'));
    }
874308
public function addLink( $uri, $relation, $type = NULL ){
		$this->links[]	= array(
			'uri'		=> $uri,
			'rel'		=> $relation,
			'type'		=> $type
		);
	}
320440
function relationName( $relationType )
    {
        $names = array( eZDBInterface::RELATION_TABLE => 'TABLE',
                        eZDBInterface::RELATION_SEQUENCE => 'SEQUENCE',
                        eZDBInterface::RELATION_TRIGGER => 'TRIGGER',
                        eZDBInterface::RELATION_VIEW => 'VIEW',
                        eZDBInterface::RELATION_INDEX => 'INDEX' );
        if ( !isset( $names[$relationType] ) )
            return false;
        return $names[$relationType];
    }
755631
public static function getType($type)
    {
        if (!isset(static::$mappedTypeInstances[$type])) {
            if (!static::hasType($type)) {
                throw TypeException::typeDoesNotExist($type);
            }

            static::$mappedTypeInstances[$type] = new static::$mappedTypeClasses[$type]();
        }

        return static::$mappedTypeInstances[$type];
    }
679830
public function actionCreate($type)
    {
        if (!is_term_type_name($type)) {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
        $model = new Term();
        $model->term_type = $type;
        if ($model->loadAll(request()->post())) {
            $model->term_type = $type;
            if ($model->saveAll()) {
                set_flash_has_been_saved();
                $seo = new Seo([
                    'title'              => $model->name,
                    'slug'               => $model->slug,
                    'description'        => substr(strip_tags($model->description), 0, 255),
                    'social_image'       => $model->feature_img,
                    'social_title'       => $model->name,
                    'social_description' => substr(strip_tags($model->description), 0, 255),
                    'obj_type'           => $model->term_type,
                    'obj_id'             => $model->id,
                ]);
                $seo->save();

                return $this->redirect([
                    'update',
                    'id' => $model->id,
                ]);
            } else {
                set_flash_has_not_been_saved();

                return $this->render('create', [
                    'model'    => $model,
                    'termType' => $type,
                ]);
            }
        }

        return $this->render('create', [
            'model'    => $model,
            'termType' => $type,
        ]);
    }
123677
public function getLinkUrl(LinkRelation $relation)
    {
        $links = $this->getLinks();

        foreach ($links as $link) {
            if ($link['relation'] == $relation->toNative()) {
                return $link['uri'];
            }
        }

        return null;
    }
471585
protected function normalizeFollowableType($type)
    {
        $morphMap = Relation::morphMap();

        if (!empty($morphMap) && in_array($type, $morphMap, true)) {
            $type = array_search($type, $morphMap, true);
        }

        if (class_exists($type)) {
            return $type;
        }

        $namespace = config('follow.model_namespace', 'App');

        $modelName = $namespace.'\\'.studly_case($type);

        if (!class_exists($modelName)) {
            throw new InvalidArgumentException("Model {$modelName} not exists. Please check your config 'follow.model_namespace'.");
        }

        return $modelName;
    }
883757
protected function getGraphQLType(?string $type):?string
    {
        switch ($type) {
            case DoctrineType::BOOLEAN:
                $type = Types::BOOLEAN;
                break;
            case DoctrineType::DECIMAL:
            case DoctrineType::FLOAT:
                $type = Types::FLOAT;
                break;
            case DoctrineType::INTEGER:
            case DoctrineType::BIGINT:
            case DoctrineType::SMALLINT:
                $type = Types::INT;
                break;
            case DoctrineType::STRING:
            case DoctrineType::TEXT:
            case DoctrineType::GUID:
                $type = Types::STRING;
                break;
            case DoctrineType::TARRAY:
            case DoctrineType::SIMPLE_ARRAY:
            case DoctrineType::JSON_ARRAY:
                $type = Types::nonNull(Types::listOf(Types::STRING));
                break;
            case DoctrineType::TIME:
            case DoctrineType::TIME_IMMUTABLE:
                $type = Types::TIME;
                break;
            case DoctrineType::DATE:
                $type = Types::DATE;
                break;
            case DoctrineType::DATETIME:
                $type = Types::DATETIME;
                break;
        }

        return $type;
    }
1177635
public function getRelations($type = null) {
        if (!$type) {
            return $this->_relations;
        }

        $relations = [];

        foreach ($this->_relations as $relation) {
            if ($relation->getType() === $type) {
                $relations[$relation->getAlias()] = $relation;
            }
        }

        return $relations;
    }
1094365
public function get($type)
    {
        if ($type === self::TYPE_MAILER) {
            $name = $this->configService->getValue('system_mailer');
        } elseif ($type === self::TYPE_DISPATCHER) {
            $name = $this->configService->getValue('system_dispatcher');
        } else {
            throw new \InvalidArgumentException('Provided type does not exist');
        }

        if (empty($name)) {
            return null;
        }

        return $this->connector->getConnection($name);
    }
425929
public function getRelationships($type = null, $direction = null)
    {
        if (null === $direction) {
            $relationships = array_merge($this->inboundRelationships, $this->outboundRelationships);
        } else {
            $dir = strtoupper($direction);
            if (!in_array($direction, array('IN', 'OUT'))) {
                throw new \InvalidArgumentException(sprintf('The direction "%s" is not valid', $direction));
            }
            $relationships = ('IN' === $dir) ? $this->getInboundRelationships() : $this->getOutboundRelationships();
        }

        if (null === $type) {
            return $relationships;
        }

        $collection = array();
        foreach ($relationships as $rel) {
            if ($rel->getType() === $type) {
                $collection[] = $rel;
            }
        }

        return $collection;
    }
444670
public function query($type) {
        $query = $this->getDriver()->newQuery($type);
        $query->setRepository($this);
        $query->from($this->getTable(), $this->getAlias());

        return $query;
    }