Description
Preconditions
- Magento 2.1.2
Steps to reproduce
-
This function gets getter name. and It call findAccessorMethodName()
public function getGetterMethodName(ClassReflection $class, $camelCaseProperty)
{
$getterName = 'get' . $camelCaseProperty;
$boolGetterName = 'is' . $camelCaseProperty;
return $this->findAccessorMethodName($class, $camelCaseProperty, $getterName, $boolGetterName);
}
-
In my case, $getterName = getIsDefaultBilling $class->name = "Magento\Customer\Api\Data\AddressInterface"
-
Obviously, Magento is looking for a getter in findAccessorMethodName()
When there is no getter, findAccessorMethodName() generates an exception with message:
' ... does not have corresponding setter in class ... 'This exception is wrong and misleading.
Expected result
-
In findAccessorMethodName() of Magento\Framework\Reflection\NameFinder, the exception message should be throw new \LogicException( sprintf( 'Property "%s" does not have accessor method "%s" in class "%s".', $camelCaseProperty, $accessorName, $class->getName() ) );
Actual result
-
[Screenshot, logs]
"message": "Property "IsDefaultBilling" does not have corresponding setter in class "Magento\Customer\Api\Data\AddressInterface".",
trace":
#0 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Reflection\NameFinder.php(59): Magento\Framework\Reflection\NameFinder->findAccessorMethodName(Object(Zend\Code\Reflection\ClassReflection), 'IsDefaultBillin...', 'getIsDefaultBil...', 'isIsDefaultBill...')
#1 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Webapi\ServiceInputProcessor.php(158): Magento\Framework\Reflection\NameFinder->getGetterMethodName(Object(Zend\Code\Reflection\ClassReflection), 'IsDefaultBillin...')
#2 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Webapi\ServiceInputProcessor.php(318): Magento\Framework\Webapi\ServiceInputProcessor->_createFromArray('\Magento\Custom...', Array)
#3 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Webapi\ServiceInputProcessor.php(175): Magento\Framework\Webapi\ServiceInputProcessor->convertValue(Array, '\Magento\Custom...')
#4 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Webapi\ServiceInputProcessor.php(322): Magento\Framework\Webapi\ServiceInputProcessor->_createFromArray('Wilson\Accounta...', Array)
#5 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Webapi\ServiceInputProcessor.php(119): Magento\Framework\Webapi\ServiceInputProcessor->convertValue(Array, 'Wilson\Accounta...')
#6 D:\nginx-1.8.0\websites\magento21\vendor\magento\module-webapi\Controller\Rest\InputParamsResolver.php(101): Magento\Framework\Webapi\ServiceInputProcessor->process('Wilson\Accounta...', 'createProntoAcc...', Array)
#7 D:\nginx-1.8.0\websites\magento21\vendor\magento\module-webapi\Controller\Rest.php(299): Magento\Webapi\Controller\Rest\InputParamsResolver->resolve()
#8 D:\nginx-1.8.0\websites\magento21\vendor\magento\module-webapi\Controller\Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest()
#9 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Interception\Interceptor.php(74): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#10 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Interception\Chain\Chain.php(70): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)
#11 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Webapi\...', 'dispatch', Object(Magento\Webapi\Controller\Rest\Interceptor), Array, 'infortis_cgen_m...')
#12 D:\nginx-1.8.0\websites\magento21\app\code\Infortis\Cgen\Plugin\Magento\Framework\App\FrontController.php(32): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))
#13 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\Interception\Interceptor.php(142): Infortis\Cgen\Plugin\Magento\Framework\App\FrontController->aroundDispatch(Object(Magento\Webapi\Controller\Rest\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#14 D:\nginx-1.8.0\websites\magento21\var\generation\Magento\Webapi\Controller\Rest\Interceptor.php(39): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)
#15 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\App\Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#16 D:\nginx-1.8.0\websites\magento21\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#17 D:\nginx-1.8.0\websites\magento21\pub\index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#18 {main}