Nevertheless, your solution will work for menus: https://github.com/yiisoft/yii2/pull/438#issuecomment-18555404