0

I'm creating an input form for my module with form components as recommended by the magento2 documentation.

The uiComponent is displaying on the page however it's throwing this error - where it's showing the namespace for the model rather than the table name.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site.Vendor\Module\Model\Slideshow' doesn't exist, query was: SELECT main_table.* FROM Vendor\Module\Model\Slideshow AS main_table WHERE (id = '')

I'm not entirely sure what's the cause of this - or where it's getting the namespace from.

0

The issue was caused by using the namespace as the first argument in _init, for the resource model.

This is because it's injected into the uiComponent via di.xml

Instead use the table name - like below;

<?php

namespace Vendor\Module\Model\ResourceModel;

class Slideshow extends 
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    protected function _construct()
    {
        $this->_init('vendor_module_slideshow', 'id');
    }
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.