Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to delete single row from grid in magento

<?php
namespace VendorModuleControllerAdminhtmlModule;

use MagentoBackendAppAction;
use MagentoTestFrameworkErrorLogLogger;

class DeleteRow extends MagentoBackendAppAction
{

    
    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed('Vendor_Module::route_id');
    }

    
    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        $resultRedirect = $this->resultRedirectFactory->create();
        if ($id) {
            try {
                $model = $this->_objectManager->create('VendorModuleModelModule');
                $model->load($id);
                $model->delete();
                $this->messageManager->addSuccess(__('The Record has been deleted.'));
                return $resultRedirect->setPath('*/*/');
            } catch (Exception $e) {
                $this->messageManager->addError($e->getMessage());
                return $resultRedirect->setPath('*/*/edit', ['entity_id' => $id]);
            }
        }
        $this->messageManager->addError(__('We can't find a row to delete.'));
        return $resultRedirect->setPath('*/*/');
    }
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: Settings pages are created like this: 
Php :: dot after each character php 
Php :: laravel telescope redirect to localhost 
Php :: phpImage 
Php :: Read the index and hashid of the last block in the blockchain 
Php :: How to get ID and other string in url 
Php :: livewire layout error 
Php :: Database connection use for validation in laravel 8 
Php :: php type generic object 
Php :: spatie sluggable not working 
Php :: teaching php in interactive mode 
Php :: css en linea php 
Php :: Posting file in Database comes with unwanted quotation marks laravel 
Php :: df/mpdf/src/Cache.php on line 21 
Php :: Program to Multiply Two Numbers in php 
Php :: beanstalk run laravel command 
Php :: cf7 first_as_label 
Php :: find only selected columns 
Php :: wp ajax error handling 
Php :: title active php 
Php :: BelongsToMany relations pivot fields are null in Livewire refresh 
Php :: laravel app service provider why eloquent model error 
Php :: PHP DOMDocument, Unicode problems 
Php :: breaking long array in php 
Php :: how to access the name of menu in worpress 
Php :: Laravel/Php Carmel Casing / Title Casing 
Php :: php google authenauthenticator 
Php :: yii1 anchor tag 
Php :: leaf php 
Php :: php send to message to mobile number using springedge 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =