$form->field($model) ?

Hi! Why is working with models in forms so verbose? Passing the $model with every call seems repetitive:




<?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'username') ?>

    <?= $form->field($model, 'password')->passwordInput() ?>



Wouldn’t it be better to pass $model only once in the form creation call, making the form bind to the model?




<?php $form = ActiveForm::begin($model); ?>

    <?= $form->field('username') ?>

    <?= $form->field('password')->passwordInput() ?>



(of course such code doesn’t work now)

Also, why weren’t $this->beginPage() / endPage() calls in each and every view file left inside the framework code? Scary.

Your form can represent fields from more than one model. For instance, you might have a form where a user can edit their profile information in one place, but have that information stored in two separate database tables and represented by two different models.

It probably wouldn’t be too difficult for you to implement an extension to create forms for managing single models if you think it would be valuable to you and other users.