replace 'deleteAll' for 'foreach'

Because deleteAll not triggers events
https://github.com/yiisoft/yii2/issues/1404