Closed JosephMaxwell closed 3 years ago
Hi @JosephMaxwell. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
@JosephMaxwell do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @JosephMaxwell. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
Hi @JosephMaxwell Magento API (and codebase) are designed to work with field defined in the interface. The extension attributes functionality can be used to add and enable processing of additional fields for extensions and customizations: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/extension_attributes/adding-attributes.html
Closing this issue as not a bug for now. Do not hesitate to reach to me on slack in case of any comments/questions
Summary (*)
I am a frequent use of APIs. However, I can't always control all elements being sent to the API. If I don't have a getter/setter for a key, I get this error:
Sample dataset:
SwiftOtter\\Sample\\Api\\Data\\QuoteInterface
has no method namedgetTest
orsetTest
.Examples (*)
This happens anytime a value is to be set on a class that has no getter/setter. For example, we built a custom implementation for PayPal payments. The result is I have had to add a number of fields to my data layer, because I didn't catch all possible Paypal fields.
Proposed solution
If accepted, I will complete this task myself.
I suggest a new interface is created that will silence, but log errors.
vendor/magento/framework/Reflection/NameFinder.php
throws the error.But, we would catch it in
vendor/magento/framework/Webapi/ServiceInputProcessor.php
, line 260, IF the class implements a "silencing" interface.