Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to truncate magento table using collection

I have a custom table. I want to truncate the table using Magento collection without SQL query.

Hope someone will provide some useful information

like image 544
VijayS91 Avatar asked Oct 21 '22 17:10

VijayS91


1 Answers

I know it's a bit late but :

  $tableName = $collection->getResource()->getMainTable();
  $conn = $collection->getConnection();
  $conn->truncateTable($tableName);
like image 77
user2930516 Avatar answered Nov 01 '22 15:11

user2930516