- Issue created by @lazzyvn
Add date Field to entity content by example, it can't save data
module use this code
$submission = $form_state->getFormObject()->submitForm($form,$form_state);
$entity = $form_state->getFormObject()->getEntity();
$entity->save();
to save form data but some field widgets need to convert value by widget method massageFormValues to normalized values
$entity->save() just saves value to database with array like this field_date =>['value' => '2023-01-01']
but the date field has format value like this field_date =>['value' => ['date' => '2023-01-01']];
it will show error
Warning: Array to string conversion in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::castValue() (line 2579 of D:\www\drupal10\web\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema.php)
Active
1.0
Code