mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 20:19:42 +08:00
Fix docs: input tabular data, remove unnecessary "-1" (#19489)
Before the change, with this input:
```
$_POST = [
'Setting' => [
0 => ['value' => 'value0'],
1 => ['value' => 'value1'],
]
];
```
contents of $settings would be created as follows:
```
$settings = [
Setting(value='value0'),
];
```
after the change it will be:
```
$settings = [
Setting(value='value0'),
Setting(value='value1'),
];
```
This commit is contained in:
@ -92,7 +92,7 @@ public function actionCreate()
|
|||||||
{
|
{
|
||||||
$settings = [];
|
$settings = [];
|
||||||
if ($this->request->isPost) {
|
if ($this->request->isPost) {
|
||||||
$count = count($this->request->post($setting->tableName())) - 1;
|
$count = count($this->request->post($setting->tableName()));
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$settings[$i] = new Setting();
|
$settings[$i] = new Setting();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user