Open kanishka55 opened 1 year ago
@kanishka55 For reporting, this is indeed a bug. We'll look into it. If you find fix yourself in the, please share with a pull request.
Hi, could you please add some steps on how to replicate this?
I'm still looking into this
I have almost the same problem. I get an exception on submit:
ErrorException In EmbeddedForm.php line 162 :
foreach() argument must be of type array|object, bool given
After some debugging, I found that when the prepare()
method in open-admin-org/open-admin/src/Form/EmbeddedForm.php
checks if it gets an array or not, the problem is fixed.
/**
* Prepare for insert or update.
*
* @param array $input
*
* @return mixed
*/
public function prepare($input)
{
if (is_array($input)) { // this fixes the bug
foreach ($input as $key => $record) {
$this->setFieldOriginalValue($key);
$input[$key] = $this->prepareValue($key, $record);
}
}
return $input;
}
Describe the bug when i go to edit action and updating json field. t saves new record if i add. and does not get my previous record after edited.
below you can see my code.
System