@@ -7673,13 +7673,10 @@ private function processRelationshipQueries(
76737673 *
76747674 * @param string $startCollection The starting collection for the path
76757675 * @param array<Query> $queries Queries with nested paths
7676- * @return array|null Array of matching IDs or null if no matches
7676+ * @return array<string> |null Array of matching IDs or null if no matches
76777677 */
76787678 private function processNestedRelationshipPath (string $ startCollection , array $ queries ): ?array
76797679 {
7680- // Cache collection metadata to avoid redundant getCollection calls
7681- static $ collectionCache = [];
7682-
76837680 // Build a map of all nested paths and their queries
76847681 $ pathGroups = [];
76857682 foreach ($ queries as $ query ) {
@@ -7705,18 +7702,11 @@ private function processNestedRelationshipPath(string $startCollection, array $q
77057702 $ relationshipChain = [];
77067703
77077704 foreach ($ pathParts as $ relationshipKey ) {
7708- if (!isset ($ collectionCache [$ currentCollection ])) {
7709- $ collectionDoc = $ this ->silent (fn () => $ this ->getCollection ($ currentCollection ));
7710- $ collectionCache [$ currentCollection ] = [
7711- 'doc ' => $ collectionDoc ,
7712- 'relationships ' => \array_filter (
7713- $ collectionDoc ->getAttribute ('attributes ' , []),
7714- fn ($ attr ) => $ attr ['type ' ] === self ::VAR_RELATIONSHIP
7715- )
7716- ];
7717- }
7718-
7719- $ relationships = $ collectionCache [$ currentCollection ]['relationships ' ];
7705+ $ collectionDoc = $ this ->silent (fn () => $ this ->getCollection ($ currentCollection ));
7706+ $ relationships = \array_filter (
7707+ $ collectionDoc ->getAttribute ('attributes ' , []),
7708+ fn ($ attr ) => $ attr ['type ' ] === self ::VAR_RELATIONSHIP
7709+ );
77207710
77217711 $ relationship = null ;
77227712 foreach ($ relationships as $ rel ) {
0 commit comments