Skip to content

Commit 5cfe3ef

Browse files
author
Anton Evers
authored
Resolve fatal error in repository generator
Both InputException and NoSuchEntityException require a Phrase object as first constructor argument `PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\\Framework\\Exception\\InputException::__construct() must be an instance of Magento\\Framework\\Phrase, string given`
1 parent d48faba commit 5cfe3ef

File tree

1 file changed

+2
-2
lines changed
  • lib/internal/Magento/Framework/ObjectManager/Code/Generator

1 file changed

+2
-2
lines changed

lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ protected function _getGetMethod()
223223
/** @var ParameterReflection $parameterReflection */
224224
$parameterReflection = $methodReflection->getParameters()[0];
225225
$body = "if (!\$id) {\n"
226-
. " throw new \\" . InputException::class . "('ID required');\n"
226+
. " throw new \\" . InputException::class . "(__('ID required'));\n"
227227
. "}\n"
228228
. "if (!isset(\$this->registry[\$id])) {\n"
229229
. " \$entity = \$this->" . $this->_getSourcePersistorPropertyName()
230230
. "->loadEntity(\$id);\n"
231231
. " if (!\$entity->getId()) {\n"
232-
. " throw new \\" . NoSuchEntityException::class . "('Requested entity doesn\\'t exist');\n"
232+
. " throw new \\" . NoSuchEntityException::class . "(__('Requested entity doesn\\'t exist'));\n"
233233
. " }\n"
234234
. " \$this->registry[\$id] = \$entity;\n"
235235
. "}\n"

0 commit comments

Comments
 (0)