Questions tagged [resource-model]
Questions specific to Magento Resource Model Classes. These classes are the middle point between the Database and Models.
208 questions
0 votes
2 answers
56 views
Issue with implementing unique_purchases column in main table using leftJoin in Grid ResourceModel
I have a SQL query that does what I need SELECT ipi.*, COALESCE(unique_purchases, 0) AS unique_purchases FROM mst_inventory_planner_inventory AS ipi LEFT JOIN ( SELECT product_id, COUNT(DISTINCT ...
0 votes
2 answers
167 views
How to persist the value of a custom field on the customer_entity table?
I'm new to Magento 2 and to this forum. I'm trying to add a newsletter subscription on the customer menu, just after the core one. For that, i created a module "ACME_Newsletter" I added a ...
2 votes
0 answers
66 views
Code refactor - EntityManager, ResourceModel and handlers
I have a slider module which use EntityManager. I want to refactor code to use ResourceModel, but i have problem with many to many relations. With EntityManager i used EntityManager\Operation\...
0 votes
1 answer
107 views
Magento2: How to add data in child table?
I have a custom module with named A and db tab is z ok. now question is my: How to add child table? which is already I have done with PK and FK key constrains. How to add data in created child table ...
0 votes
1 answer
1k views
How to get Identity of recently inserted for Resource Save *(Magento 2.3.5)
The answer linked here mentioned (in the comments more specifically) that I am supposed to be able to get the Id from the repository/resource), it also more importantly confirmed that $model->save()...
0 votes
1 answer
486 views
Url parameter in magento 2 collection filter
I need to filter Magento 2 custom grid model collection by URL parameter. I have used this below code. protected function _initSelect() { $objectManager = \Magento\Framework\App\...
0 votes
1 answer
224 views
Create a ResourceModel based on 3rd Party API Call from Magento
I am working on integrating a 3rd Party API into Magento. I'd like to use an Admin Grid with a Data Source that comes from a 3rd party API. So Essentially the Flow work like this... User Loads into ...
0 votes
0 answers
234 views
How to modify data of Custom Field before rendering to backend form?
I have created a simple crud module that renders form with a few basic fields and saves data into database. Module is working fine and saving data correctly in the database. Issue is before rendering ...