Helper function to get access on the static declared repository

@return \Shopware\Models\Customer\Repository
@throws \Exception
500668
protected function getRepository()
    {
        if ($this->repository === null) {
            $this->repository = $this->container->get('models')->getRepository(Customer::class);
        }
        return $this->repository;
    }
801111
public function getRepository($type)
    {
        try {
            $ldapObjectSchema = $this->getLdapObjectSchema($type);
            $repositoryClass = $ldapObjectSchema->getRepository();
            if (!class_exists($repositoryClass)) {
                throw new \RuntimeException(sprintf('Repository class "%s" not found.', $repositoryClass));
            }
            $repository = new $repositoryClass($ldapObjectSchema, $this->getConnection());
            if (!($repository instanceof LdapObjectRepository)) {
                throw new \RuntimeException('Your repository class must extend \LdapTools\Object\LdapObjectRepository.');
            }
        } catch (\Exception $e) {
            throw new \RuntimeException(sprintf('Unable to load Repository for type "%s": %s', $type, $e->getMessage()));
        } catch (\Throwable $e) {
            throw new \RuntimeException(sprintf('Unable to load Repository for type "%s": %s', $type, $e->getMessage()));
        }

        return $repository;
    }
1221752
public function getStatRepository()
    {
        if (!$this->em->isOpen()) {
            $this->em = $this->em->create(
                $this->em->getConnection(),
                $this->em->getConfiguration(),
                $this->em->getEventManager()
            );
        }

        return $this->em->getRepository('MauticContactClientBundle:Stat');
    }
79323
private function getSiteaccessesByRepository()
    {
        $siteaccesses = [];
        foreach ($this->siteaccesses as $siteaccess) {
            $repository = $this->resolveRepositoryName(
                $this->configResolver->getParameter('repository', null, $siteaccess)
            );

            if (!isset($siteaccesses[$repository])) {
                $siteaccesses[$repository] = [];
            }

            $siteaccesses[$repository][] = $siteaccess;
        }

        return $siteaccesses;
    }
1207983
private function getUiTIDSavedSearchRepository()
    {
        $metadata = $this->metadata->serialize();
        $tokenCredentials = $metadata['uitid_token_credentials'];

        $savedSearchesService = $this->savedSearchesServiceFactory->withTokenCredentials($tokenCredentials);

        $repository = new UiTIDSavedSearchRepository($savedSearchesService);

        if ($this->logger) {
            $repository->setLogger($this->logger);
        }

        return $repository;
    }
645995
protected function _repository()
    {
        $source = $this->getSource();
        if ($source === null) {
            list(, $class) = namespaceSplit(get_class($this));
            $source = Inflector::pluralize($class);
        }

        return TableRegistry::getTableLocator()->get($source);
    }
475448
private function getRepository()
    {
        $c = $this->repository;
        if ($c instanceof \Closure) {
            $this->repository = $c();
        }

        return $this->repository;
    }
795438
public function getJunctionRepository() {
        if ($repo = $this->_junction) {
            return $repo;
        }

        $this->setJunctionRepository(new Repository($this->getJunction()));

        return $this->_junction;
    }
276393
protected function getRepositoryEndpoint()
    {
        // Get credentials
        $repository = $this->getRepositoryCredentials();
        $username = Arr::get($repository, 'username');
        $password = Arr::get($repository, 'password');
        $repository = Arr::get($repository, 'repository');

        // Add credentials if possible
        if ($username || $password) {
            // Encore parameters
            $username = urlencode($username);
            $password = urlencode($password);

            // Build credentials chain
            $credentials = $password ? $username.':'.$password : $username;
            $credentials .= '@';

            // Add them in chain
            $repository = preg_replace('#https://(.+)@#', 'https://', $repository);
            $repository = str_replace('https://', 'https://'.$credentials, $repository);
        }

        return $repository;
    }
165530
private function getRepository()
    {
        if (!file_exists($this->storage)) {
            throw new \Exception('Tokens storage file not found.');
        }

        $file = file_get_contents($this->storage);
        return json_decode($file);
    }
549900
public function getReferenceRepository()
    {
        if ( ! $this->referenceRepository) {
            $this->referenceRepository = new ProxyReferenceRepository($this->entityManager);
        }

        return $this->referenceRepository;
    }
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);
    }
804425
public function getRepository()
    {
        if (!$this->_repository instanceof AnDomainRepositoryAbstract) {
            if (!$this->_repository instanceof AnServiceIdentifier) {
                $this->setRepository($this->_repository);
            }

            $this->_repository = $this->getService($this->_repository);
        }

        return $this->_repository;
    }
422054
public function getObject()
    {
        //security check
        if (!isset($this->_object)) {
            $condition = array($this->_property => $this->_value);
            $repository = AnDomain::getRepository($this->getIdentifier());

            //check if an entity exiting in the repository with $condition
            if ($data = $repository->find($condition, false)) {
                $this->_object = $data;

                return $this->_object;
            }

            //now time to fetch the object from the database
            //but lets grab all the similar entities all together
            $handle = $this->getIdentifier().$this->_property;
            $values = isset(self::$_values[$handle]) ? self::$_values[$handle] : array();

            if (empty($values)) {
                return;
            }

            $values = AnHelperArray::unique($values);
            $query = $repository->getQuery();
            AnDomainQueryHelper::applyFilters($query, $this->_relationship->getQueryFilters());
            $query->where(array($this->_property => $values));
            $entities = $repository->fetchSet($query);

            //the object must have been fetched with the set
            //in the previous line
            //if the object is still not fetched, then the object
            //doesn't exists in the databse
            $this->_object = $repository->find($condition, false);

            if (!$this->_object) {
                //lets cache the null result to prevent re-fetching
                //the same result
                $query = $repository->getQuery()->where($condition)->limit(1);

                if ($repository->hasBehavior('cachable')) {
                    $repository->emptyCache($query);
                }

                $this->_object = false;

                //if it's a required one-to-one relationship
                //then instantaite a new entity if the entity doesn't exists
                if ($this->_relationship->isOneToOne()) {
                    if ($this->_relationship->isRequired()) {
                        $this->_object = $repository->getEntity(array(
                            'data' => array($this->_property => $this->_value),
                        ));
                    }
                }
            }

            unset(self::$_values[$handle]);
        }

        return $this->_object;
    }
84148
public function getKey()
    {
        $repository = $this->om->getRepository($this->modelName);
        $count = 0;

        do {
            ++$count;

            if ($count > static::MAX_API_KEY_GENERATION_ATTEMPTS) {
                throw new \RuntimeException(sprintf(
                    'Unable to generate a new api key, stopping after %d tries!',
                    static::MAX_API_KEY_GENERATION_ATTEMPTS
                ));
            }

            $key = $this->doGenerate();
        } while (null !== $repository->findOneBy(array($this->metadata->getPropertyName(ClassMetadata::API_KEY_PROPERTY) => $key)));

        return $key;
    }
323196
public static function get()
    {

        $database = DatabaseProvider::getDb();
        $r = new \ReflectionMethod(Database::class, 'getConnection');
        $r->setAccessible(true);

        return $r->invoke($database);
    }
989294
static function instance()
    {
        $confirmOrderHandler = null;
        if ( eZExtension::findExtensionType( array( 'ini-name' => 'shopaccount.ini',
                                                    'repository-group' => 'HandlerSettings',
                                                    'repository-variable' => 'Repositories',
                                                    'extension-group' => 'HandlerSettings',
                                                    'extension-variable' => 'ExtensionRepositories',
                                                    'type-group' => 'ConfirmOrderSettings',
                                                    'type-variable' => 'Handler',
                                                    'alias-group' => 'ConfirmOrderSettings',
                                                    'alias-variable' => 'Alias',
                                                    'subdir' => 'confirmorderhandlers',
                                                    'type-directory' => false,
                                                    'extension-subdir' => 'confirmorderhandlers',
                                                    'suffix-name' => 'confirmorderhandler.php' ),
                                             $out ) )
        {
            $filePath = $out['found-file-path'];
            include_once( $filePath );
            $class = $out['type'] . 'ConfirmOrderHandler';
            return new $class();
        }

        return new eZDefaultConfirmOrderHandler();
    }