/** * Set namespace to model if form is named so the data is bound properly */ protected function setupNamedModel() { if (!$this->getModel() || !$this->getName()) { return; } $model = $this->formHelper->convertModelToArray($this->getModel()); if (!array_get($model, $this->getName())) { $this->model = [$this->getName() => $model]; } }
/** * Set namespace to model if form is named so the data is bound properly */ protected function setupNamedModel() { if (!$this->getModel() || !$this->getName()) { return; } $dotName = $this->formHelper->transformToDotSyntax($this->getName()); $model = $this->formHelper->convertModelToArray($this->getModel()); if (!array_get($model, $dotName)) { $newModel = []; array_set($newModel, $dotName, $model); $this->model = $newModel; } }