protected function _getRepositoryList(RepositoryInterface $repository, $associations)
    {
        $repositories = [
            $repository->getRegistryAlias() => $repository
        ];

        foreach ($associations as $association) {
            $association += [
                'association' => null,
                'children' => []
            ];

            if ($association['association'] === null) {
                throw new \InvalidArgumentException("Association does not have an association object set");
            }

            $associationRepository = $association['association']->getTarget();

            $repositories += $this->_getRepositoryList($associationRepository, $association['children'] ?: []);
        }

        return $repositories;
    }
protected function _getRepositoryList(RepositoryInterface $repository, $associations)
    {
        $repositories = [
            $repository->getRegistryAlias() => $repository
        ];

        foreach ($associations as $association) {
            $association += [
                'association' => null,
                'children' => []
            ];

            if ($association['association'] === null) {
                throw new \InvalidArgumentException("Association does not have an association object set");
            }

            $associationRepository = $association['association']->getTarget();

            $repositories += $this->_getRepositoryList($associationRepository, $association['children'] ?: []);
        }

        return $repositories;
    }
protected function _getRepositoryList ( RepositoryInterface $ repository , $ associations ) { $ repositories = [ $ repository -> getRegistryAlias ( ) => $ repository ] ; foreach ( $ associations as $ association ) { $ association += [ 'association' => null , 'children' => [ ] ] ; if ( $ association [ 'association' ] === null ) { throw new \ InvalidArgumentException ( "Association does not have an association object set" ) ; } $ associationRepository = $ association [ 'association' ] -> getTarget ( ) ; $ repositories += $ this -> _getRepositoryList ( $ associationRepository , $ association [ 'children' ] ? : [ ] ) ; } return $ repositories ; }
Get a flat list of all repositories indexed by their registry alias.

@param RepositoryInterface $repository Current repository
@param array $associations Nested associations to get repository from
@return array Used repositories indexed by registry alias
@internal
Get a flat list of all repositories indexed by their registry alias .