If an attribute in a Model holds array data, say Dates, that are populated in a form with multiple rows for this attribute, how may I assign initial values to the array elements so that they display initially in the form when it appears.
In my example, my array-type attribute holds dates and I want each new date row in the form to have different values when the form loads.
<?= $form->field($model, 'datesToPay[]') ?>
I tried to use the DefaultValueValidator filter of Yii2 to assign initial value to the datesToPay array elements but it does not show the value when the form loads.
['datesToPay', 'each', 'rule' => ['default', 'value' => date('Y-m-d')]]