cancel
Showing results for 
Search instead for 
Did you mean: 

Call The Table Prefix

SOLVED

Call The Table Prefix

Hello

 

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 ? 

3 REPLIES

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

@Antoine553

 

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

 

https://mage2.pro/t/topic/529/2

Re: Call The Table Prefix

thanks you