8
8
9
9
use Magento \Framework \Api \ExtensionAttribute \JoinProcessorInterface ;
10
10
use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
11
+ use Magento \Framework \Api \SearchCriteriaInterface ;
12
+ use Magento \Framework \Exception \NoSuchEntityException ;
13
+ use Magento \Framework \Exception \InputException ;
11
14
use Zend \Code \Reflection \MethodReflection ;
12
15
use Zend \Code \Reflection \ParameterReflection ;
13
16
@@ -21,13 +24,6 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract
21
24
*/
22
25
const ENTITY_TYPE = 'repository ' ;
23
26
24
- /**
25
- * No Such Entity Exception
26
- */
27
- const NO_SUCH_ENTITY_EXCEPTION = '\\Magento\Framework\Exception\NoSuchEntityException ' ;
28
- const INPUT_EXCEPTION = '\\Magento\Framework\Exception\InputException ' ;
29
- const SEARCH_CRITERIA = '\\Magento\Framework\Api\SearchCriteriaInterface ' ;
30
-
31
27
/**
32
28
* The namespace of repository interface
33
29
* @var string
@@ -227,13 +223,13 @@ protected function _getGetMethod()
227
223
/** @var ParameterReflection $parameterReflection */
228
224
$ parameterReflection = $ methodReflection ->getParameters ()[0 ];
229
225
$ body = "if (! \$id) { \n"
230
- . " throw new " . self :: INPUT_EXCEPTION . "('ID required'); \n"
226
+ . " throw new " . InputException::class . "('ID required'); \n"
231
227
. "} \n"
232
228
. "if (!isset( \$this->registry[ \$id])) { \n"
233
229
. " \$entity = \$this-> " . $ this ->_getSourcePersistorPropertyName ()
234
230
. "->loadEntity( \$id); \n"
235
231
. " if (! \$entity->getId()) { \n"
236
- . " throw new " . self :: NO_SUCH_ENTITY_EXCEPTION . "('Requested entity doesn \\'t exist'); \n"
232
+ . " throw new " . NoSuchEntityException::class . "('Requested entity doesn \\'t exist'); \n"
237
233
. " } \n"
238
234
. " \$this->registry[ \$id] = \$entity; \n"
239
235
. "} \n"
@@ -261,11 +257,11 @@ protected function _getGetMethod()
261
257
],
262
258
[
263
259
'name ' => 'throws ' ,
264
- 'description ' => self :: INPUT_EXCEPTION ,
260
+ 'description ' => InputException::class ,
265
261
],
266
262
[
267
263
'name ' => 'throws ' ,
268
- 'description ' => self :: NO_SUCH_ENTITY_EXCEPTION ,
264
+ 'description ' => NoSuchEntityException::class ,
269
265
],
270
266
],
271
267
]
@@ -514,7 +510,7 @@ protected function _getGetListMethod()
514
510
'parameters ' => [
515
511
[
516
512
'name ' => 'searchCriteria ' ,
517
- 'type ' => self :: SEARCH_CRITERIA ,
513
+ 'type ' => SearchCriteriaInterface::class ,
518
514
],
519
515
],
520
516
'body ' => $ body ,
@@ -523,7 +519,7 @@ protected function _getGetListMethod()
523
519
'tags ' => [
524
520
[
525
521
'name ' => 'param ' ,
526
- 'description ' => self :: SEARCH_CRITERIA . ' $searchCriteria ' ,
522
+ 'description ' => SearchCriteriaInterface::class . ' $searchCriteria ' ,
527
523
],
528
524
[
529
525
'name ' => 'return ' ,
0 commit comments