Customization Response Formatter For Controller Or Action

Hello!

How i can use customization xml formatter for my action or controller? I need change XML formatter for definite action.

I can change Response object in my init controller, but it’s hardcore.


Yii::$app->response->formatters['XML'] = ['class' => 'myClass'];