@@ -293,13 +293,12 @@ public function testInIterate($useRefetchObjectMethod): void
293293 $ queryBuilder ->select ('b ' )
294294 ->andWhere ('b.bookId != :bookId ' )
295295 ->setParameter ('bookId ' , 7 );
296- $ iterableResult = $ queryBuilder ->getQuery ()->iterate ();
296+ $ iterableResult = $ queryBuilder ->getQuery ()->toIterable ();
297297
298298 $ i = 0 ;
299- foreach ($ iterableResult as $ row ) {
299+ /** @var Book $book */
300+ foreach ($ iterableResult as $ book ) {
300301 ++$ i ;
301- /** @var Book $book */
302- $ book = current ($ row );
303302
304303 if (!$ book ->getAuthors ()->contains ($ author )) {
305304 $ book ->addAuthor ($ author );
@@ -367,35 +366,6 @@ public function testNotManagedObject($useRefetchObjectMethod): void
367366 $ this ->em ->flush ();
368367 }
369368
370- #[DataProvider('getUseRefetchObjectMethodProdiver ' )]
371- public function testIndirectRefetch ($ useRefetchObjectMethod ): void
372- {
373- /** @var Author $author */
374- $ author = $ this ->em ->getRepository (Author::class)->find (2 );
375- $ this ->assertNotNull ($ author );
376- /** @var Book $book */
377- $ book = $ this ->em ->getRepository (Book::class)->find (1 );
378- $ this ->assertNotNull ($ book );
379-
380- $ this ->em ->clear ();
381-
382- if ($ useRefetchObjectMethod ) {
383- $ this ->refetchManager ->refetchObject ($ book );
384- } else {
385- $ book = $ this ->refetchManager ->getObject ($ book );
386- }
387-
388- $ this ->expectException (\InvalidArgumentException::class);
389- $ this ->expectExceptionMessage ('Entity has to be managed ' );
390- $ author ->setLastName ('My new last name ' );
391- $ this ->em ->flush ($ author );
392-
393- $ countAuthors = $ book ->getAuthors ()->count (); // (lazy association collection
394- $ author ->setLastName ('My new last name ' );
395- $ this ->em ->flush ($ author );
396- $ this ->checkUnitOfWork (2 , [$ book , $ author ]);
397- }
398-
399369 #[DataProvider('getUseRefetchObjectMethodProdiver ' )]
400370 public function testWithCompositePk ($ useRefetchObjectMethod ): void
401371 {
@@ -505,13 +475,12 @@ public function testGetCollectionFromCriteriaInIterate(): void
505475 $ queryBuilder ->select ('b ' )
506476 ->andWhere ('b.bookId != :bookId ' )
507477 ->setParameter ('bookId ' , 9 );
508- $ iterableResult = $ queryBuilder ->getQuery ()->iterate ();
478+ $ iterableResult = $ queryBuilder ->getQuery ()->toIterable ();
509479
510480 $ i = 0 ;
511- foreach ($ iterableResult as $ row ) {
481+ /** @var Book $book */
482+ foreach ($ iterableResult as $ book ) {
512483 ++$ i ;
513- /** @var Book $book */
514- $ book = current ($ row );
515484
516485 foreach ($ authors as $ author ) {
517486 if (!$ book ->getAuthors ()->contains ($ author )) {
0 commit comments