-
-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boltforms/ContentType and Date field type #3459
Comments
Hi @leocavalcante, Could you give a bit more information about what you were doing, that caused these errors? I think your solution won't cause any side-effects, but we'd need to test those out. |
Sure! To reproduce just link a Boltforms to a ContentType with a date/datetime type field: contenttypes.yml: form_requests:
name: Form Requests
singular_name: Form Request
fields:
title:
type: text
date:
type: date
file:
type: file boltforms.bolt.yml: form_request:
database:
contenttype: form_requests
fields:
title:
type: text
date:
type: date
file:
type: file
submit:
type: submit index.twig {{ boltforms('form_request') }} Try to submit a request and got:
I added a file type cause I think it wont will link properly to. Just as headsup. Changing to table: form_request:
database:
#contenttype: form_requests
table: bolt_form_requests Doest not resolve, both |
This also needs the following in https://github.com/GawainLynch/bolt-extension-boltforms/blob/master/src/Email.php#L96 And maybe the formatting must be some user readable format foreach($formdata as $key => $value) {
if ($value instanceof \DateTime) {
$formdata[$key] = $value->format('c');
}
} |
Not sure if Bolt must know how to handle field values or if Boltforms should pass it already as strings. Sorry if issue is in wrong place. |
The game is changing in that regard when we start work on Bolt 2.3… Watch this space 😁 For now we'll handle in BoltForms, @jadwigo PRed a fix today and I have merged it into the BF master branch and will tag a release soon(ish). |
Closing as we're working around this now in BoltForms and as mentioned Bolt 2.3 has some significant updates on this. |
I was getting
Catchable fatal error: Object of class DateTime could not be converted to string
if a form field of type birthday linked to an ContentType field of type date.The solution was:
Bolt\Content.php below line 287
Bolt\Extension\Bolt\BoltForms\Database.php below line 81
Not sure if is the best solution, but solved to me.
The text was updated successfully, but these errors were encountered: