Linked Questions

1
vote
1answer
145 views

how can we implement service contracts in magento 2 in controller? [duplicate]

please answer with simple example of customer detail in which we can access customer detail save() data Delete() getbyid() update() requirements. all functions in controller using ...
1
vote
0answers
34 views

service contract save method flow - magento 2 [duplicate]

I can able to get custom table records from database using service contract but hard to understand the save flow. di.xml <preference for="Mobi\Service\Api\RcRepositoryInterface" type="Mobi\...
53
votes
4answers
13k views

Deprecated save and load methods in Abstract Model

I see that in the develop branch of the Magento 2 repo the methods load and save from Magento\Framework\Model\AbstractModel class are deprecated. But there are a gazillion classes in the core that ...
15
votes
2answers
10k views

Best Way to Load a Custom Model in Magento 2

Because it was hard for me to find the right way, below you could find the best practice I made mine. Enjoy, correct my English if needed and say me I'm wrong if I am. :) Edit : ... and I found out I ...
8
votes
2answers
2k views

What and why is the proper way to load a model

I have quite a lot of experience with Magento but I realized that I don't understand which way of loading a model is the correct one and why. I've read everything that I could, about the topic but ...
2
votes
1answer
579 views

difference between Model\ProductRepository and Api\ProductRepositoryInterface

What is the difference between using \Magento\Catalog\Model\ProductRepository and \Magento\Catalog\Api\ProductRepositoryInterface? Which one is better and recommended to use?
1
vote
2answers
300 views

How write a Magento 2 standard Model class

I have create database table and want to create model,resource,Collection class and know that how to create. Have follow the blog https://www.softprodigy.com/store/article/create-model-and-...
1
vote
1answer
324 views

Magento 2, Cannot `getCollection()` from model factory

Using magento 2.2, CRUD, API. I got an error while try to access method getCollection(). { "messages": { "error": [ { "code": 500, "...
0
votes
2answers
309 views

Magento 2 - Class int[] does not exist

Scratching my head with this issue, and I just do not understand why this is happening in the first place. Made a custom REST API call to remove multiple items from the cart with one single API call ...
6
votes
1answer
161 views

What are the use of ExtensionAttribute JoinProcessorInterface and CollectionProcessorInterface at magento 2.2.3

I built Magento 2 Module which has a model and Service contracts/API. During this implementation, I have followed vinai Kopp article and also magento2 module Magento_Quote. On this Magento\Quote\...
2
votes
1answer
152 views

Magento Recommended way to add comment to order

I am looking for the Magento recommended best practice for adding a comment to an order. I can easily accomplish this using things such as $order->addCommentToStatusHistory($message)->save() and ...
2
votes
1answer
128 views

Code Generator for Services in Magento 2

Magento 2 recommends us to use Service Contracts and we have to define all getter/setters explicitly in the interface and them provide a base implementation to save fields in the database. It's a lot ...
1
vote
1answer
71 views

Can not get model by id

I have the following Observer event that is called after the product is saved. Subscribers is a custom model <?php namespace Namespace\Modulename\Observer; use Magento\Framework\Event\...
2
votes
0answers
81 views

What is the proper way of implementing service contracts in Magento 2?

I have a simple module with custom entity and I wanted to implement service contracts. I've read some articles about it and watched the course on Magento U (Fundamentals of Magento 2 development). ...
0
votes
2answers
38 views

Magento2: how to develop rest API to get new products

I want to get new product using REST API. I am using below code:- app/code/Myvendor/Mymodule/Api/NewproductInterface.php <?php namespace Myvendor\Mymodule\Api; //use Myvendor\...

15 30 50 per page