Yii2 has this cute little thing called DynamicModel . This basically allows you to create the model on the fly so that you can still use all ActiveForm and validation, but without having to write the entire model class for it. May be interesting.
Example from the documentation:
public function actionSearch($name, $email) { $model = DynamicModel::validateData(compact('name', 'email'), [ [['name', 'email'], 'string', 'max' => 128], ['email', 'email'], ]); if ($model->hasErrors()) {
Obviously, this instance can also be used for ActiveForm widget. You can then perform the correct validation in your actions, and then transfer your MailChimp data. It may be convenient if you want to run HTML Purifier as part of this check for content
Blizz
source share