Linked Questions

2
votes
1answer
288 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
37 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\...
58
votes
4answers
17k 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 ...
16
votes
2answers
13k 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 ...
9
votes
2answers
3k 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
758 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
725 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
401 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-...
0
votes
2answers
608 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 ...
1
vote
1answer
571 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, "...
8
votes
1answer
284 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\...
0
votes
2answers
293 views

REST V1/customers adding a new extension attribute Magento 2.3.1

I have added a new field as "is_seller" in registration page (same as "is_subscribed). If the checkbox is clicked the customer Id will be saved to another table with some additional values. It was ...
2
votes
1answer
157 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 ...
0
votes
2answers
169 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\...
0
votes
0answers
116 views

Magento 2 PHPMD and Coupling Between Object classes (CBO)

I'm working on a Magento 2 CRUD functionality following the best practices (best described here). On the project I'm working on we are using PHPMD (php mess detector). Among other rules, we have the ...

15 30 50 per page