0

Magento 2, Why we use data folder in api? Use of data folder in api

If anyone knows please explain me Thanks.

0

Api directory have repositories.

It Contains set of code that third-party developers can call, implement, or build as a plug-in. Magento guarantees that this code will not change in subsequent releases without a major version change.

In general, the purpose of a repository is to hide the storage related logic.

Api/Data contains the Data Model Interfaces. These have getter and setter functions.

For more details you can go through following links : http://vinaikopp.com/2017/02/18/magento2_repositories_interfaces_and_webapi/ https://devdocs.magento.com/guides/v2.2/extension-dev-guide/api-concepts.html

0

It's part of the Magento 2 Service Layer.

Your code should depend of abstractions not concrete implementations. This makes the code more extensible and flexible.

From the Magento 2 docs https://devdocs.magento.com/guides/v2.2/architecture/archi_perspectives/service_layer.html

Related Topics

Dependency Injection and Dependency Inversion.

The topic is big and this answer is brief the guide provided above should offer more perspective on the matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.