Showing results for 
Search instead for 
Did you mean: 

Call The Table Prefix


Call The Table Prefix



It's me again as you know i'm new in Magento and something is disturbing me i'm searching a way to call the database prefix set in the begining of the installation like _DB_PREFIX_ in Prestashop but every post i saw about this wasn't really clear and very complicated for something that simple can someone tell me if there is a simple way pls ? 


Re: Call The Table Prefix

You can get tablename like below way,

$obj = \Magento\Framework\App\ObjectManager::getInstance();
$connection = $obj->get('Magento\Framework\App\ResourceConnection')->getConnection();
$prefixTablename = $connection->getTableName('tablename'); // pass your tablename
echo $prefixTablename;

Please let me know if you have query or I am wrong.

If Issue Solved, Click Kudos/Accept As solutions.

Re: Call The Table Prefix



If you want to get table name into your install schema then use below link for reference

Re: Call The Table Prefix

thanks you