Gets the relations mapped to properties.

@return IRelation[]
168224
public function getPropertyRelationMap(): array
    {
        $relations = [];

        foreach ($this->getRelationMappings() as $mapping) {
            $accessor = $mapping->getAccessor();

            if ($accessor instanceof PropertyAccessor) {
                $relations[$accessor->getPropertyName()] = $mapping->getRelation();
            }
        }

        return $relations;
    }
281260
public function getAllRelations()
    {
        if (count($this->allRelations) === 0) {
            $allRelations = array_merge(array_keys($this->relations), array_keys($this->localRelatedFilters));

            foreach ($allRelations as $related) {
                $this->allRelations[$related] = array_merge($this->getLocalRelation($related), $this->getRelatedFilterInput($related));
            }
        }

        return $this->allRelations;
    }
574804
protected function getRelations()
    {
        // Based on Barryvdh\LaravelIdeHelper\Console\ModelsCommand::getPropertiesFromMethods().
        return collect(get_class_methods($this->model))
            ->reject(function ($methodName) {
                return method_exists(Model::class, $methodName);
            })
            ->filter(function ($methodName) {
                $methodCode = $this->getMethodCode($methodName);

                return collect([
                    'belongsTo',
                    'morphTo',
                    'morphOne',
                    'morphMany',
                    'belongsToMany',
                    'morphedByMany',
                ])->contains(function ($relationName) use ($methodCode) {
                    return stripos($methodCode, "\$this->$relationName(");
                });
            })
            ->map(function ($methodName) {
                return $this->model->$methodName();
            })
            ->filter(function ($relation) {
                return $relation instanceof Relation;
            })
            ->all();
    }
1037874
public function getRelations():array
    {
        $relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations));

        return array_filter($relations, function($relation) {
            return $relation !== '*';
        });
    }
1312940
public function getDirtyRelations()
    {
        $dirtyRelations = [];
        foreach ($this->_relations as $relationName) {
            if (array_key_exists($relationName, $this->_oldRelationValue)) {
                $dirtyRelations[$relationName] = $this->owner->{$relationName};
            }
        }
        return $dirtyRelations;
    }
255515
private function getParentAndChildrenEntities() {
        $parentEntities = array();
        $childrenEntities = array();
        foreach($this->getModelBuilder()->getRelationships() as $relationship) {
            if($relationship->isPlural()) {
                $parentEntities[] = $relationship->getAlias() . '.*';
            } else {
                $childrenEntities[] = $relationship->getAlias() . '.*';
            }
        }

        return array($parentEntities, $childrenEntities);
    }
1099096
public static function relations($type = null) {
		$self = static::_object();

		if ($type === null) {
			return static::_relations();
		}
		if (isset($self->_relationFieldNames[$type])) {
			$type = $self->_relationFieldNames[$type];
		}

		if (isset($self->_relations[$type])) {
			return $self->_relations[$type];
		}
		if (isset($self->_relationsToLoad[$type])) {
			return static::_relations(null, $type);
		}
		if (in_array($type, $self->_relationTypes, true)) {
			return array_keys(static::_relations($type));
		}
	}
1015123
public function getOwners()
    {
        return collect($this->belongsToRelations())
            ->reject(function ($relation) {
                // Rejects the relations whose foreign keys have been passed as custom attributes.
                return array_key_exists($relation->{$this->getBelongsToForeignKeyNameMethod()}(), $this->customAttributes)
                    || array_key_exists($relation->{$this->getBelongsToForeignKeyNameMethod()}(), $this->getFactoryAttributes($this->model))

                    // And the relations of the model to itself to prevent infinite recursion.
                    || $relation->getRelated() instanceof $this->model

                    // And dynamic relations in which the foreign key is selected with a subquery.
                    || !isset($this->columns[$relation->getRelated()->getForeignKey()]);
            })
            ->map(function ($relation) {
                return get_class($relation->getRelated());
            })
            ->all();
    }
279740
public function getRawAttributes(): array
    {
        $attributes = $this->wrappedEntity->getEntityAttributes();

        foreach ($this->entityMap->getNonEmbeddedRelationships() as $relation) {
            unset($attributes[$relation]);
        }

        if ($this->entityMap->getInheritanceType() == 'single_table') {
            $attributes = $this->addDiscriminatorColumn($attributes);
        }

        $attributes = $this->entityMap->getColumnNamesFromAttributes($attributes);

        $attributes = $this->flattenEmbeddables($attributes);

        $foreignKeys = $this->getForeignKeyAttributes();

        return $this->mergeForeignKeysWithAttributes($foreignKeys, $attributes);
    }
107711
public function getRequiredRelationProperties(): array
    {
        if (null !== $this->requiredRelationProperties) {
            return $this->requiredRelationProperties;
        }
        $traits = $this->reflectionClass->getTraits();
        $return = [];
        foreach ($traits as $traitName => $traitReflection) {
            if (false === \ts\stringContains($traitName, '\\HasRequired')) {
                continue;
            }
            if (false === \ts\stringContains($traitName, '\\Entity\\Relations\\')) {
                continue;
            }

            $property          = $traitReflection->getProperties()[0]->getName();
            $return[$property] = $this->getTypesFromVarComment(
                $property,
                $this->getReflectionHelper()->getTraitProvidingProperty($traitReflection, $property)
            );
        }
        $this->requiredRelationProperties = $return;

        return $return;
    }
1250856
public function getRelations ()
	{
		
		// Create new database tool

		$db	= new Db;
		
		$relations	= $db->getRelations ($this->get ('database'), $this->get ('table'));
		$namespace	= $this->getRootNamespace ();

		// Loop through constraints

		foreach ($relations as $constraint)
		{
			
			// If the attribute exists
			
			if (isset ($this->attributeCache[$constraint['attribute']]))
			{
				
				// Add relationship
				
				$this->attributeCache[$constraint['attribute']]['relation']	= $this->parser->convertToClassName ($constraint['table'], $namespace);
				
			}

		}
		
	}
645976
protected function getRelations($relations)
    {
        $existingNames = [];
        $finalRelations = [];
        foreach ($relations as $relation) {
            $newRelation = ForeignRelationship::fromString($relation);
            if (is_null($newRelation)) {
                continue;
            }

            if (!empty($newRelation->name) && in_array($newRelation->name, $existingNames)) {
                continue;
            }

            $finalRelations[] = $newRelation;
            $existingNames[] = $newRelation->name;
        }

        return $finalRelations;
    }
77442
public function resolvedRelationshipKeys(): array
    {
        $includeMap = $this->includeMap();

        $keys = [];
        foreach ($this->resolvedIncludeKeys() as $includeKey) {
            $relations = $includeMap[$includeKey]['relation'] ?? [];
            if (\count($relations) > 0) {
                array_push($keys, ...$relations);
            }
        }

        return array_unique($keys);
    }
1182460
public function propertiesIdents()
    {
        $metadata = $this->proto()->metadata();
        if (isset($metadata['admin']['lists'])) {
            $adminMetadata   = $metadata['admin'];
            $collectionIdent = $this->collectionIdent();
            if (isset($adminMetadata['lists'][$collectionIdent]['properties'])) {
                return $adminMetadata['lists'][$collectionIdent]['properties'];
            }
        }

        return [];
    }
745502
public function getPropertyNames() {
    return array_map(function (ClassMemberNode $property) {
      return ltrim($property->getName(), '$');
    }, $this->getProperties()->toArray());
  }
1171532
public function getNonLazyRelationships()
    {
        $rels = [];
        foreach ($this->relationships as $relationship) {
            if (!$relationship->isLazy()) {
                $rels[] = $relationship;
            }
        }

        return $rels;
    }
297597
protected function getRelations()
    {
        $relations = [];
        $rawRelations = $this->getRawRelations();
        foreach ($rawRelations as $rawRelation) {
            $relations[] = $this->getRealtion($rawRelation->foreignTable, $rawRelation->foreignKey, $rawRelation->localKey, $rawRelation->selfReferences);
        }

        return $relations;
    }