@@ -92,6 +92,11 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
9292 */
9393 private $ serviceInputValidator ;
9494
95+ /**
96+ * @var int
97+ */
98+ private $ defaultPageSize ;
99+
95100 /**
96101 * Initialize dependencies.
97102 *
@@ -104,6 +109,7 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
104109 * @param ConfigInterface|null $config
105110 * @param array $customAttributePreprocessors
106111 * @param ServiceInputValidatorInterface|null $serviceInputValidator
112+ * @param int|null $defaultPageSize
107113 */
108114 public function __construct (
109115 TypeProcessor $ typeProcessor ,
@@ -114,7 +120,8 @@ public function __construct(
114120 ServiceTypeToEntityTypeMap $ serviceTypeToEntityTypeMap = null ,
115121 ConfigInterface $ config = null ,
116122 array $ customAttributePreprocessors = [],
117- ServiceInputValidatorInterface $ serviceInputValidator = null
123+ ServiceInputValidatorInterface $ serviceInputValidator = null ,
124+ int $ defaultPageSize = null
118125 ) {
119126 $ this ->typeProcessor = $ typeProcessor ;
120127 $ this ->objectManager = $ objectManager ;
@@ -128,6 +135,7 @@ public function __construct(
128135 $ this ->customAttributePreprocessors = $ customAttributePreprocessors ;
129136 $ this ->serviceInputValidator = $ serviceInputValidator
130137 ?: ObjectManager::getInstance ()->get (ServiceInputValidatorInterface::class);
138+ $ this ->defaultPageSize = $ defaultPageSize ?: 20 ;
131139 }
132140
133141 /**
@@ -304,7 +312,7 @@ protected function _createFromArray($className, $data)
304312 if ($ object instanceof SearchCriteriaInterface
305313 && $ object ->getPageSize () === null
306314 ) {
307- $ object ->setPageSize (20 );
315+ $ object ->setPageSize ($ this -> defaultPageSize );
308316 }
309317
310318 return $ object ;
0 commit comments