How To Truncate A Table With Doctrine 1


Doctrine ORM does not provide a built in method to truncate a table, so we must run a sql query manually. Use the below code and alter the SQL as needed:

$doctrine = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh();
$doctrine->query('TRUNCATE TABLE tableName');
unset($doctrine);

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “How To Truncate A Table With Doctrine