0

I need to create a new module and this project have tables with other prefixes, How I omit this default prefix in my file /Model/ModelTable.php

this is the code inside:

namespace Arkix\Zonas\Model\Resource;

class Zona extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{

    /**
     * Construct
     *
     * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
     * @param string|null $resourcePrefix
     */
    public function __construct(
        \Magento\Framework\Model\ResourceModel\Db\Context $context,
        $resourcePrefix = null
    ) {
        parent::__construct($context, $resourcePrefix);     
    }

    /**
     * Model Initialization
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init('app_places_zones', 'id');
    }
}
  • magento say this error: 2 exception(s): Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mambo_dev2.mam_places_zones' doesn't exist, query was: SELECT COUNT(*) FROM mam_places_zones AS main_table Exception #1 (PDOException): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mambo_dev2.mam_places_zones' doesn't exist – andrwsv Jan 11 at 21:53
  • you need to create that table to your current DB schema or if you have an old database that is working export from there then import it to your current DB. – magefms Jan 12 at 2:34
  • @andrwsv please explain what are you trying i din't get what you want to do. :) – Himanshu Jan 12 at 5:18
  • @Himanshu This proyect have old tables created for other person and I need create one CRUD for that tables and that is my problem with prefix in the file model – andrwsv Jan 12 at 15:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.