Custom form "Data too long for column"

by Vincent   Last Updated December 21, 2017 18:07 PM

I create a custom entity (pool) with a custom form.

In my custom form, i have a field (start_date)

$form['start_date'] = [
  '#type' => 'datetime',
  '#title' => t('Start Date'),
  '#default_value' => new DrupalDateTime()
];

When i want to save, i have the follow error :

"Data too long for column"

In the log, the value is : 2017-12-21 18:06:29 Europe/Paris Instead of 2017-12-21T17:06:29

What i'm doing wrong ?



Related Questions


Best way to store not publicly viewable data?

Updated May 14, 2016 08:03 AM

Create and update nodes via a module in Drupal 8

Updated April 11, 2016 09:03 AM

How to debug AJAX entity wrapper error?

Updated July 29, 2017 19:07 PM


Querying a custom entity throws Exception

Updated April 11, 2017 10:07 AM