@@ -92,6 +92,11 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
92
92
*/
93
93
private $ serviceInputValidator ;
94
94
95
+ /**
96
+ * @var int
97
+ */
98
+ private $ defaultPageSize ;
99
+
95
100
/**
96
101
* Initialize dependencies.
97
102
*
@@ -104,6 +109,7 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
104
109
* @param ConfigInterface|null $config
105
110
* @param array $customAttributePreprocessors
106
111
* @param ServiceInputValidatorInterface|null $serviceInputValidator
112
+ * @param int|null $defaultPageSize
107
113
*/
108
114
public function __construct (
109
115
TypeProcessor $ typeProcessor ,
@@ -114,7 +120,8 @@ public function __construct(
114
120
ServiceTypeToEntityTypeMap $ serviceTypeToEntityTypeMap = null ,
115
121
ConfigInterface $ config = null ,
116
122
array $ customAttributePreprocessors = [],
117
- ServiceInputValidatorInterface $ serviceInputValidator = null
123
+ ServiceInputValidatorInterface $ serviceInputValidator = null ,
124
+ int $ defaultPageSize = null
118
125
) {
119
126
$ this ->typeProcessor = $ typeProcessor ;
120
127
$ this ->objectManager = $ objectManager ;
@@ -128,6 +135,7 @@ public function __construct(
128
135
$ this ->customAttributePreprocessors = $ customAttributePreprocessors ;
129
136
$ this ->serviceInputValidator = $ serviceInputValidator
130
137
?: ObjectManager::getInstance ()->get (ServiceInputValidatorInterface::class);
138
+ $ this ->defaultPageSize = $ defaultPageSize ?: 20 ;
131
139
}
132
140
133
141
/**
@@ -304,7 +312,7 @@ protected function _createFromArray($className, $data)
304
312
if ($ object instanceof SearchCriteriaInterface
305
313
&& $ object ->getPageSize () === null
306
314
) {
307
- $ object ->setPageSize (20 );
315
+ $ object ->setPageSize ($ this -> defaultPageSize );
308
316
}
309
317
310
318
return $ object ;
0 commit comments