0

I'm very new to magento 2.3, I'm facing some error maybe from DB side....

Here is my code:

/app/code/EC/Customimport/Controller/Adminhtml/Index/Import.php

<?php

namespace EC\Customimport\Controller\Adminhtml\Index;

use EC\Customimport\Model\CustomimportFactory;
use Magento\Framework\Controller\ResultFactory;
use Magento\Backend\App\Action\Context;

class Import extends \Magento\Backend\App\Action
{
    protected $request;

    /**
     * @param Context $context
     */
    public function __construct(
        \Magento\Framework\App\Request\Http $request,
        Context $context,
        CustomimportFactory $modelCustomimportFactory
    ) {
        $this->request = $request;
        $this->modelCustomimportFactory = $modelCustomimportFactory;
        $this->resultFactory = $context->getResultFactory();
        parent::__construct($context);
    }

    public function execute(){
        ignore_user_abort(true);
        set_time_limit(0);

        $ids = $this->getRequest()->getParams('customimport_id'); 

            $model = $this->modelCustomimportFactory->create()->load($id);
            $model->import();

        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        $resultRedirect->setPath('adminhtml/*/index');
        return $resultRedirect;

    }
}

ERROR:

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s),
query was: 
SELECT `customimport`.* FROM `customimport` 
WHERE 
(`customimport`.`customimport_id`='true', '4', 'FrFt7XBKVOwNwaq2')
  • 1
    what is the (customimport.customimport_id='true', '4', 'FrFt7XBKVOwNwaq2')? – Rutvee Sojitra May 15 at 12:32
  • A query......... – Saif Zakir May 15 at 12:34
  • I know, but customimport_id's value why like 'true', '4', 'FrFt7XBKVOwNwaq2'? – Rutvee Sojitra May 15 at 12:35
  • basically customimport is a table in my DB & customimport_id='4' – Saif Zakir May 15 at 12:35
  • @RutveeSojitra don't know why its making a wrong query..... – Saif Zakir May 15 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.