8
8
9
9
namespace Magento \PageBuilderAnalytics \Model ;
10
10
11
- use Magento \Analytics \ReportXml \QueryFactory ;
12
11
use Magento \Analytics \ReportXml \ConnectionFactory ;
13
- use Magento \PageBuilder \ Model \ Config ;
12
+ use Magento \Analytics \ ReportXml \ IteratorFactory ;
14
13
use Magento \Analytics \ReportXml \Query ;
14
+ use Magento \Analytics \ReportXml \QueryFactory ;
15
15
use Magento \Framework \DB \Adapter \AdapterInterface ;
16
+ use Magento \PageBuilder \Model \Config ;
16
17
17
18
/**
18
19
* Provides content type usage data report
@@ -29,6 +30,11 @@ class ContentTypeUsageReportProvider
29
30
*/
30
31
private $ queryFactory ;
31
32
33
+ /**
34
+ * @var IteratorFactory
35
+ */
36
+ private $ iteratorFactory ;
37
+
32
38
/**
33
39
* @var ConnectionFactory
34
40
*/
@@ -50,11 +56,13 @@ class ContentTypeUsageReportProvider
50
56
public function __construct (
51
57
Config $ config ,
52
58
QueryFactory $ queryFactory ,
59
+ IteratorFactory $ iteratorFactory ,
53
60
ConnectionFactory $ connectionFactory ,
54
61
$ batchSize = 5000
55
62
) {
56
63
$ this ->config = $ config ;
57
64
$ this ->queryFactory = $ queryFactory ;
65
+ $ this ->iteratorFactory = $ iteratorFactory ;
58
66
$ this ->connectionFactory = $ connectionFactory ;
59
67
$ this ->batchSize = $ batchSize ;
60
68
}
@@ -106,9 +114,7 @@ public function getReport($name) : \IteratorIterator
106
114
$ reportData [] = [$ type ['name ' ], $ typeCounts [$ type ['name ' ]]];
107
115
}
108
116
109
- return new \IteratorIterator (
110
- new \ArrayIterator ($ reportData )
111
- );
117
+ return $ this ->iteratorFactory ->create ($ reportData );
112
118
}
113
119
114
120
/**
0 commit comments