Retrieve a repository by its name

@param string $name the repository name

@return Repository $repository
487215
public function get($name)
    {
        /** @var Repository $repository */
        foreach ($this->repositories as $repository) {
            if ($repository->getName() == $name) {
                return $repository;
            }
        }

        return null;
    }
35068
public static function getOrCreateRepository($name)
    {
        $name = $name == Repository::class
            ? 'default'
            : str_replace(Repository::class . '.', '', $name);

        $repository = null;
        if (array_key_exists($name, static::$repositories)) {
            $repository = static::$repositories[$name];
        } else {
            $fullName = Repository::class . '.' . $name;
            if (!context()->exists($fullName)) {
                /**
                 * Lazy load.
                 */
                $config = config('database.' . $name);
                /**
                 * @T00D00 - this means that we're overloading every non-default repository to default one?
                 *         - this is needed when mixing different and using multiple repositories
                 *         - maybe the best thing would be to change repositories when needed (leave defaults?)
                 */
                if (!$config && $name != 'default') {
                    $config = config('database.default');
                }
                $repository = RepositoryFactory::getRepositoryByConfig($config, $name);
                context()->bind($fullName, $repository);
            }

            $repository = context()->get($fullName);
        }

        if (!$repository) {
            throw new Exception('Cannot prepare repository');
        }

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

        return $this->get($this->nameMap[$name]);
    }
231702
public function getCacheRepository($name) {
    return array_key_exists($name, $this->cacheRepositories) ? $this->cacheRepositories[$name] : null;
  }
90161
def get_repository(name):
    '''
    
    '''
    # Putting quotes around the parameter protects against command injection
    cmd = 'Get-PSRepository "{0}"'.format(name)
    no_ret = _pshell(cmd)
    return name not in list_modules()
173902
function getRepository($entityName)
    {
        if (isset($this->cachedRepository[$entityName])) {
            return $this->cachedRepository[$entityName];
        }
        $className = "Fredy\\Model\\Repository\\Repository";
        $entityClassName = 'Model\\Entity\\'.$entityName;
        return new $className(new $entityClassName(),$this->db);
    }
380660
public function getRepository($name = null) {
		try {
			return parent::getRepository($name);
		} catch(\yii\base\UnknownPropertyException $e) {
		
		}
		
		if(!isset($this->coreRepository)) {
			$this->coreRepository = ClassHelper::createObject([
				'class' => BaseActiveCoreRepository::class,
				'domain' => $this->domain,
				'id' => $this->id,
				'point' => $this->point,
			]);
		}
		return $this->coreRepository;
	}
714027
public static function get($name)
    {
        if (isset($_REQUEST[$name])) {
            return $_REQUEST[$name];
        }

        if (isset($_GET[$name])) {
            return $_GET[$name];
        }

        return;
    }
795338
public function get($name)
    {
        if (isset($this->container['CI']->{$name})) {
            return $this->container['CI']->{$name};
        }
        return $this->container[$name];
    }
1283878
public function findByName($name)
    {
        return $this->getEntityManager()
            ->createQuery('SELECT r FROM GloobyTaskBundle:Schedule r WHERE r.name = :name')
            ->setParameter('name', $name)
            ->useQueryCache(true)
            ->getSingleResult();
    }
802030
public function getRepository($className)
    {
        if (isset($this->repositories[$className])) {
            return $this->repositories[$className];
        }

        $metadata = $this->getClassMetadata($className);
        $customRepositoryClassName = $metadata->getCustomRepositoryClassName();

        if ($customRepositoryClassName !== null) {
            $repository = new $customRepositoryClassName($this, $this->unitOfWork, $metadata);
        } else {
            $repository = new ModelRepository($this, $this->unitOfWork, $metadata);
        }

        $this->repositories[$className] = $repository;

        return $repository;
    }
217830
public function getRepository($repositoryName)
    {
        $repositoryName = (string)$repositoryName;
        if(!isset($this->config['repositories'][$repositoryName]['class'])) return false;
        $className = $this->config['repositories'][$repositoryName]['class'];
        if (!class_exists($className)) {
            return false;
        }
        $connectionName = isset($this->config['repositories'][$repositoryName]['connection'])?$this->config['repositories'][$repositoryName]['connection']:null;
        return new $className($connectionName);
    }
1163380
public static function getResource(string $name)
    {
        $resource = static::getInstance($name)->getResource();

        if(RequestContext::exsits() && $resource)
        {
            static::pushResourceToRequestContext($resource);
        }

        return $resource;
    }
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;
    }
1348356
public function getRepository($name)
    {
        try {
            $response = $this->request($name);
        } catch (ResponseException $e) {
            if (404 == $e->getResponse()->getStatus()) {
                throw new NotFoundException("Repository '".$name."' does not exist.");
            }
            throw $e;
        }
        $data = $response->getData();

        return $data[$name];
    }
1071329
public function findByName($name)
    {
        foreach ($this->findAll() as $datasourceNode) {
            if ($datasourceNode->getName() === $name) {
                return $datasourceNode;
            }
        }
    }
1019193
protected function getRepository()
    {
        if (null === $this->repository) {
            $this->repository = $this->getEntityManager()
                    ->getRepository($this->getModuleNamespace() . '\Entity\\' . $this->getEntityName());
        }
        return $this->repository;
    }