db->createCommand($sql)->queryAll(); if($res){// 数据存在则删除这两个区域 foreach ($res as $item){ $sql = "delete from qimall_region where id = {$item['id']}"; $this->execute($sql); } } } catch (\Exception $e) { } } /** * {@inheritdoc} */ public function safeDown() { echo "M240809143855DeleteRegion cannot be reverted.\n"; return false; } }