Retrieve a reference by name.

@param string    $name       Reference name.

@return mixed                Model instance if found, null otherwise.

@throws RepositoryException  If this model or the referenced model is not handled by a managed repository.
179239
public function getReference($name)
    {
        if (!isset($this->_manager)) {
            throw new RepositoryException('Model is not handled by a managed repository');
        }
        if (array_key_exists($name, $this->_references)) {
            $ref = $this->_references[$name];
            $repo = $this->_manager->getByClass($ref['model']);
            if (!$repo) {
                throw new RepositoryException('Referenced model is not handled by a managed repository');
            }
            return ($repo->find($ref['key'], $this->{$ref['attribute']}) ?: null);
        }
        return null;
    }
1049009
protected function getForeignModelFromRequest($name)
    {
        $this->checkForeignModelFromRequest($name);
        $requestKey = $this->getRequestKeyFromString($name);

        return $this->getRequest()->attributes->get($requestKey);
    }
742467
public function getHasManyByRelationName($name)
    {
        if ($table = $this->getReferencingTable($name)) {
            if ($model = static::getModelFromTable($table)) {
                $refField = $this->getReferencingField($table, $name);

                return $this->hasMany($model, $refField);
            }
        }

        return null;
    }
1270227
protected function getReferencingTable($name)
    {
        $references = $this->getReferences();

        if (array_key_exists($name, $references)) {
            return $references[$name]->refTable;
        }

        return null;
    }
46159
public static function getTypeByName($name)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $typeRec = static::whereName($name)->get(['type'])->first();

        return (isset($typeRec, $typeRec['type'])) ? $typeRec['type'] : null;
    }
589275
function get($name){
        if(!isset($this->db[$name])){
            return null;
        }
        $r = $this->db[$name];
        return $r();
    }
231702
public function getCacheRepository($name) {
    return array_key_exists($name, $this->cacheRepositories) ? $this->cacheRepositories[$name] : null;
  }
868429
public function getByName($name)
	{
		return isset($this->nameList[$name]) ? $this->nameList[$name] : null;
	}
1232705
public function getRepository($name = null)
    {
        if (is_null($name) || empty($name)) {
            $manager_class = get_class($this);
            $name = str_replace(array('\\Manager\\', 'Manager', '\\'), array(':', '', ''), $manager_class);
            $name = str_replace(
                array('\\Manager\\', '\\Bundle\\', 'Manager', '\\'),
                array(':', '', ''),
                $manager_class
            );
        }

        return $this->container->get('doctrine.orm.entity_manager')->getRepository($name);
    }
442321
public function getRelation($name)
    {
        // We want to run a relationship query without any constrains so that we will
        // not have to remove these where clauses manually which gets really hacky
        // and error prone. We don't want constraints because we add eager ones.
        $relation = Relation::noConstraints(function () use ($name) {
            try {
                return $this->getModel()->{$name}();
            } catch (BadMethodCallException $e) {
                throw new RuntimeException("Call to undefined relationship [".$name."] on model [".get_class($this->getModel())."].");
            }
        });

        $nested = $this->relationsNestedUnder($name);

        // If there are nested relationships set on the query, we will put those onto
        // the query instances so that they can be handled after this relationship
        // is loaded. In this way they will all trickle down as they are loaded.
        if (count($nested) > 0) {
            $relation->getQuery()->with($nested);
        }

        return $relation;
    }
797821
public function getStaticPropertyValue($name)
    {
        $properties = $this->getStaticProperties();

        if (array_key_exists($name, $properties)) {
            return $properties[$name];
        }
        throw new ModelException(
            'Property ' . $name . ' does not exist or is not static.'
        );
    }
1079230
public function getModel(string $name = '')
    {
        if (empty($name)) {
            $name = $this->getComponentsName();
        }

        // Create a model instance from a different app?
        $model = $this->MVCFactory($name, 'Model');

        return $model;
    }
992486
public function getByName($name)
    {
        if (!isset($this->nameMap[$name])) {
            return null;
        }

        return $this->get($this->nameMap[$name]);
    }
75702
public function getHasOneByRelationName($name)
    {
        if ($table = $this->getReferencingTable($name)) {
            if ($model = static::getModelFromTable($table)) {
                $refField = $this->getReferencingField($table, $name);

                return $this->hasOne($model, $refField);
            }
        }

        return null;
    }
531491
protected function getRelation($name)
    {
        $relation = $this->relations[$name];
        if ($relation instanceof self || (\is_array($relation) && $relation[0] instanceof self)) {
            return $relation;
        }

        $class = 'App\\Model\\' . $relation[1];
        /** @var Model $model */
        $model = new $class();

        switch ($relation[0]) {
            case self::HAS_ONE:
                $this->relations[$name] = $model->eq($relation[2], $this->__get($this->primary))->get();
                break;
            case self::HAS_MANY:
                $this->relations[$name] = $model->eq($relation[2], $this->__get($this->primary))->select();
                break;
            case self::BELONGS_TO:
                $this->relations[$name] = $model->get($this->__get($relation[2]));
                break;
            default:
                throw new ModelException("Relation $name not found.");
        }

        return $this->relations[$name];
    }
1311408
public function getRepository(string $name): Repository
    {
        if (!isset($this->repositories[$name])) {
            throw new \InvalidArgumentException(\sprintf(
                'The name %s is not a valid repository, try one of %s',
                $name,
                \implode(', ', \array_keys($this->repositories))
            ));
        }

        return $this->repositories[$name];
    }
1061628
public static function fetchByName( $name )
    {
        $result = parent::fetchObject( self::definition(), null, array( 'name' => $name ) );
        return $result;
    }