@@ -70,17 +70,19 @@ public function findMany(array $ids): array {
7070 return $ result ;
7171 }
7272
73- $ qb = $ this ->db ->getQueryBuilder ();
74- $ qb ->select ('v.* ' , 't.ownership ' )
75- ->from ($ this ->table , 'v ' )
76- ->innerJoin ('v ' , 'tables_tables ' , 't ' , 't.id = v.table_id ' )
77- ->where ($ qb ->expr ()->in ('v.id ' , $ qb ->createNamedParameter (array_keys ($ missing ), IQueryBuilder::PARAM_INT_ARRAY )));
78-
79- $ entities = $ this ->findEntities ($ qb );
80- foreach ($ entities as $ entity ) {
81- $ id = $ entity ->getId ();
82- $ this ->cache [(string )$ id ] = $ entity ;
83- $ result [$ id ] = $ entity ;
73+ $ missing = array_keys ($ missing );
74+ foreach (array_chunk ($ missing , 1000 ) as $ missingChunk ) {
75+ $ qb = $ this ->db ->getQueryBuilder ();
76+ $ qb ->select ('v.* ' , 't.ownership ' )
77+ ->from ($ this ->table , 'v ' )
78+ ->innerJoin ('v ' , 'tables_tables ' , 't ' , 't.id = v.table_id ' )
79+ ->where ($ qb ->expr ()->in ('v.id ' , $ qb ->createNamedParameter ($ missingChunk , IQueryBuilder::PARAM_INT_ARRAY )));
80+
81+ foreach ($ this ->findEntities ($ qb ) as $ entity ) {
82+ $ id = $ entity ->getId ();
83+ $ this ->cache [(string )$ id ] = $ entity ;
84+ $ result [$ id ] = $ entity ;
85+ }
8486 }
8587 return $ result ;
8688 }
0 commit comments