Truncating table before seeding in cakephp
问题 I'm wondering if there is a better (more smooth) way to disable foreign key checks, truncate table, insert data and enable foreign key checks when you seed database with cakephp 3. This is my current code which is not working <?php use Migrations\AbstractSeed; use Cake\Datasource\ConnectionManager; /** * Categories seed. */ class CategoriesSeed extends AbstractSeed { public function run() { $connection = ConnectionManager::get('default'); $connection->execute('SET FOREIGN_KEY_CHECKS = 0');