22
33namespace Doctrine \Tests \ORM \Functional ;
44
5+ use Doctrine \DBAL \Types \Type as DBALType ;
56use Doctrine \ORM \Query ;
67use Doctrine \ORM \Tools \Pagination \Paginator ;
8+ use Doctrine \Tests \DbalTypes \CustomIdObject ;
9+ use Doctrine \Tests \DbalTypes \CustomIdObjectType ;
710use Doctrine \Tests \Models \CMS \CmsArticle ;
811use Doctrine \Tests \Models \CMS \CmsEmail ;
912use Doctrine \Tests \Models \CMS \CmsGroup ;
1013use Doctrine \Tests \Models \CMS \CmsUser ;
1114use Doctrine \Tests \Models \Company \CompanyManager ;
15+ use Doctrine \Tests \Models \CustomType \CustomIdObjectTypeParent ;
1216use Doctrine \Tests \Models \Pagination \Company ;
1317use Doctrine \Tests \Models \Pagination \Department ;
1418use Doctrine \Tests \Models \Pagination \Logo ;
1519use Doctrine \Tests \Models \Pagination \User1 ;
1620use Doctrine \Tests \OrmFunctionalTestCase ;
1721use ReflectionMethod ;
22+ use function iterator_to_array ;
1823
1924/**
2025 * @group DDC-1613
@@ -26,6 +31,14 @@ protected function setUp()
2631 $ this ->useModelSet ('cms ' );
2732 $ this ->useModelSet ('pagination ' );
2833 $ this ->useModelSet ('company ' );
34+ $ this ->useModelSet ('custom_id_object_type ' );
35+
36+ if (DBALType::hasType (CustomIdObjectType::NAME )) {
37+ DBALType::overrideType (CustomIdObjectType::NAME , CustomIdObjectType::class);
38+ } else {
39+ DBALType::addType (CustomIdObjectType::NAME , CustomIdObjectType::class);
40+ }
41+
2942 parent ::setUp ();
3043 $ this ->populate ();
3144 }
@@ -641,6 +654,27 @@ public function testQueryWalkerIsKept()
641654 $ this ->assertEquals (1 , $ paginator ->count ());
642655 }
643656
657+ /**
658+ * @group GH-7890
659+ */
660+ public function testCustomIdTypeWithoutOutputWalker ()
661+ {
662+ $ this ->_em ->persist (new CustomIdObjectTypeParent (new CustomIdObject ('foo ' )));
663+ $ this ->_em ->flush ();
664+
665+ $ dql = 'SELECT p FROM Doctrine\Tests\Models\CustomType\CustomIdObjectTypeParent p ' ;
666+ $ query = $ this ->_em ->createQuery ($ dql );
667+
668+ $ paginator = new Paginator ($ query , true );
669+ $ paginator ->setUseOutputWalkers (false );
670+
671+ $ matchedItems = iterator_to_array ($ paginator ->getIterator ());
672+
673+ self ::assertCount (1 , $ matchedItems );
674+ self ::assertInstanceOf (CustomIdObjectTypeParent::class, $ matchedItems [0 ]);
675+ self ::assertSame ('foo ' , (string ) $ matchedItems [0 ]->id );
676+ }
677+
644678 public function testCountQueryStripsParametersInSelect ()
645679 {
646680 $ query = $ this ->_em ->createQuery (
0 commit comments