Questions tagged [crud]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
25
votes
1answer
4k views

Magento 2.1: using the entity manager

From 2.1 Magento has introduced Magento/Framework/Model/EntityManager I may be wrong here but from my understanding it is to replace Magento/Framework/Model/AbstractModel which was implementing the ...
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 ...
14
votes
3answers
1k views

Magento 2: what are the benefits of using service contracts?

So as some of you may know, Magento 2 recommended way to deal with models/collections for CRUD actions is to use service contracts. But still according to the Magento SE Q&A it seems like most ...
12
votes
2answers
6k views

Adding an image form element to an add/edit form

I'm building a CRUD module for Magento 2 using ui components for admin list and form and one of my entities has an image field. But I cannot make it work as it should. Here is how it should work. When ...
11
votes
1answer
1k views

Avoiding save in a loop in mass action

I've created my own CRUD module that contains an inline edit action similar to the one for CMS pages Everything works OK, but when running phpsniffer with the EcgM2 standard I get this warning: ...
9
votes
2answers
237 views

Magento 2 and Services Contracts

I know there is a lot of topics about this question but I'm not sure to clearly understand.. When did we need to use service contract ? Are they replacing the CRUD done by Model / ResourceModel ? ...
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 ...
8
votes
4answers
2k views

Example of Code and Configuration Needed for a Simple Magento 2 CRUD Model?

How can I, an end-user-programmer, create a new "CRUD" model in Magento 2? That is, I want to create the PHP class files and XML configuration files that will Let me Create, Read, Update and Delete ...
6
votes
3answers
610 views

Magento 2.2.5 : Cant go to execute() in Controller

I'm doing a simple CRUD custom module after this module C:\xampp\htdocs\magento\vendor\magento\module-cms\Controller\Adminhtml\Page\Save.php and I have a controller to save/create/add the "students" ...
5
votes
2answers
4k views

Magento 2 Custom Module Insert Data Issue

I'm using Magento 2 CE Version 2.1.0 I'm making a custom module. For developing custom module i'm taking reference of Magento CMS Module {folder path}\magento2\vendor\magento\module-cms I have below ...
4
votes
1answer
835 views

Adding input prefix in an admin form

I'm trying to build a CRUD module for Magento 2 by using the ui components. but I need to add a prefix for all my inputs in the form. So if I add a field called name I need the field name to actually ...
3
votes
2answers
81 views

Magento 2.2.5: Add Student Instead of Update Student

So instead of update the student, this code add a new student. I'm looking for a way that not using object manager, because the objectmanager is recommended not to use. So when i searching for how to ...
3
votes
2answers
1k views

Magento\Framework\Exception\NoSuchEntityException when updating products

I am Trying to update product programmatically magento2 Magento ver. 2.1.2 Hear is my code require 'vendor/autoload.php'; use Magento\Framework\App\Bootstrap; include('app/bootstrap.php'); $...
3
votes
0answers
52 views

Magento 2 : How to get top 10 repeated values in a column using CRUD instead of sql?

I want to get top 10 most repeated values in a column of my table, I can do so using sql but I need to do it using CRUD i.e using collections or model as magento coding standard doesn't allow naked ...
2
votes
1answer
29 views

UIComponent Form - Spinner showing

In my Form UIComponent only a spinner is showing. I compared my implementation to several ways it is implemented. The grid is showing just fine, i only have the problem in the form. My layout file: &...
2
votes
3answers
6k views

Magento 2 Compile Generation Does Not Exist

I'm using Magento 2 CE Version 2.1.0 C:\wamp\www\magento2>C:\wamp\bin\php\php5.6.19\php.exe bin/magento setup:di:compile Compilation was started. %message% 0/7 [>---------------------------] ...
2
votes
1answer
75 views

How to load cusomer model by token

is it possible to load customer model using only token? One of my method generate a token this way: $token = Mage::helper('customer')->generateResetPasswordLinkToken(); $customer->...
2
votes
1answer
1k views

i need set flag in model save before event and get in model save after event in magento 2

I have Create two event model save before and after i get specific object and set flag in before model and get in after model. for example in before model public function execute(\Magento\...
2
votes
0answers
25 views

Magento 2 - Can I have to create API, Interface & Resource Model for relational table

I am creating a module which have three tables let's say for example table1 -------- id int(13) PRIMARY_KEY title varchar(50) table2 -------- id int(13) PRIMARY_KEY title varchar(255) table3 `...
2
votes
2answers
50 views

Cusotm module edit action redirects it to the dashborard

I created Grid using UI Components and provide Edit action using < actionsColumn > in vendormodulename_entity_list.xml <actionsColumn name="actions" class="Vendor\Modulename\Ui\Component\...
2
votes
1answer
332 views

CRUD logic in Controller or Block?

I have referred several blogs which explains CRUD functionality, some of the blogs write code like saving a model, in a Controller and some in a Block. Blogs CRUD functionality in Block : http://...
2
votes
0answers
80 views

How to go around “Incorrect namespace usage(s)” in static tests

I have a simple CRUD module for Magento 2. When I run the static tests I get the following error/warning. "Incorrect namespace usage(s) found in file..... <Vendor>_<Module>". The ...
1
vote
2answers
174 views

Magento2: Can anyone describe crud operation?

Can anyone describe the CRUD operations by admin panel ?
1
vote
1answer
1k views

Can Any one Describe a Basic CRUD Operation in Magento Front Side [duplicate]

I want to Know what is the process of ADD Update Delete in Magento from front side. so can any one help with code.
1
vote
2answers
695 views

Can Anyone Describe a Basic CRUD Operation of Magento From Admin Side in Magento

I want to understand the actual crud operation from admin side with coding.
1
vote
1answer
746 views

What is ->load(),->getData() in Magento and how does it work

$deal_m = Mage::getModel('dailydeals/deal')->load($deal_ids, 'deal_id'); $deal_m->getData() I can understand this above code will get the values for deal_id=$deal_ids from the deal table.But I ...
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, "...
1
vote
1answer
2k views

Magento 2.2 CRUD(Add,Update,Delete,Inline Edit) with ui component

My Concern is i want to develop basic extension with ui component with simple crud operation so i am referencing cms-page. What i have achived so far: Grid is properly working(with filter,column ...
1
vote
1answer
101 views

Magento2 error when trying to create a record in db

I have the following resource model. namespace Vendor\Gift\Model\ResourceModel; class GiftInformation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { protected function _construct(...
1
vote
0answers
89 views

Magento 2 API - crud for all tables

Is it possible to create a new REST API to update or create data in all magento tables from a xml added in POST : <data> <row table="Nom_Table_1" key="Nom_Champ_Key_1"> <...
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\...
1
vote
2answers
578 views

Updating product in the catalog

I've some code to import some products: if the prodocut is new, I've insert it in the catalog, otherwise, I've to update the product if there are some changes. Code is the following: <?php ...
0
votes
2answers
5k views

Delete a row by custom field in Magento

I am facing an issue with deleting rows from table by custom field. Below my database table link_id | quote_id | giftcard_value | giftcard | redeemed_at ---------------------------------------------...
0
votes
1answer
2k views

Update table use where codition(CRUD) - Magento 2

I need to update particular field in table using CRUD operation of Magento. I have tried below for insert new record it is working $this->_cancelFactory->create()->setData(array('...
0
votes
3answers
763 views

Correct way to save entries to database

I want to know, what is the correct way to implement CRUD operations in Magento 2? because I found a lot of examples but they use deprecated methods. I created a table ('quote reserved item') with ...
0
votes
1answer
257 views

Magento 1: most efficient way to bulk add entities

So I'm working on a CRUD module that creates entities based on an XML feed. Right now, I'm using Magento system, so I have an array of data that I use to populate my object then call the save() ...
0
votes
2answers
382 views

Magento 2 : CRUD, Invalid method _getResource() in model when Save

Magento CE 2.2.0; I created CRUD for model 'people' and save data in to database by controller for testing. While i try to save by using controllor Add: $_person = $this->_objectManager->...
0
votes
1answer
295 views

Correct way to join core tables in magento 2

I am able to join table something like this.. $totalsales = $this->orderCollectionFactory->create() ->addFieldToSelect('*') ->...
0
votes
1answer
1k views

Magento 2: Grid mass action provides collection of Magento\Framework\View\Element\UiComponent\DataProvider\Document instead of models

I'm trying to make a mass delete action for my custom grid. A very helpful source of examples is this grid sample module by Marius but still I can't find the reason why the grid pass collection of ...
0
votes
1answer
18 views

How to add a pay until date to invoice in Magento2?

Please excuse me if I am asking a dumb question, but I am new to Magento and frankly, my first impression is that it is over-designed and poorly documented. Maybe this is part of their business model, ...
0
votes
1answer
92 views

Magento 2.2.6 | Uncaught Error: Undefined class constant 'CACHE_TAG'

I am very new to Magento, i created a CRUD custom module, when I input some data in form, and hit save button, I got an error like this: Fatal error: Uncaught Error: Undefined class constant '...
0
votes
0answers
26 views

Crud module for parent and children table

i'm created crud plugin for children and parent table. Can anyone suggest how to get the data from parent table.PLease Help me. Many thanks here are may table <?php namespace ThuyNT\Crud\...
0
votes
1answer
158 views

Connect Ionic App to Magento 2.3 REST API

I'm a Magento developer and I need to connect an app developed in Ionic with the Magento 2 REST API. I need to make an extension that grants more access to a customer token, additionally, I need to ...
0
votes
1answer
56 views

Magento2 : CRUD Module Add Button Not Showing

Starting with this sample, https://github.com/mageplaza/magento-2-sample-module, I'm trying to make a CRUD manager module. I went through the sample and changed everything I could find that looked ...
0
votes
1answer
287 views

How to store dropdown value in database and display selected when edit item?

I am developing custom module. Other fields are saving data in database but i have issue with Dropdown field. It's not saving value in database. My code as following: $elements['target'] = $fieldset-&...