【发布时间】:2016-07-31 11:20:16
【问题描述】:
我有动态数量的问题和答案。我使用 DynamicModel() 来收集这些数据。
$attributes = [
"answer_1" => "Some Value 1",
"answer_2" => "Some Value 2",
"answer_3" => "Some Value 3",
.....
]
$customFormModel = new DynamicModel($attributes);
我也有
$labels = [
"answer_1" => "Label 1",
"answer_2" => "Label 2",
"answer_3" => "Label 3",
.....
]
我只是无法将 $label 数组设置为我的动态模型的标签属性。 我的 $customFormModel->attributeLabels() 总是空的。
这些结果带有以下问题。 我收到类似这样的错误消息
Answer 1 can not be blank
Answer 2 can not be blank
Answer 3 can not be blank
我想要什么
Label 1 can not be blank
Label 2 can not be blank
Label 3 can not be blank
【问题讨论】:
标签: yii2 yii-extensions yii2-advanced-app yii-components