Skip to content
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

Multistep form goto previous step: DateTime convert error #135

Closed
anianweber opened this issue Mar 15, 2021 · 5 comments
Closed

Multistep form goto previous step: DateTime convert error #135

anianweber opened this issue Mar 15, 2021 · 5 comments

Comments

@anianweber
Copy link

Reproduction

  • Create a Multistep Form where the first step contains a DatePicker
  • Fill the Value of the DatePicker, go to Step 2, and then go back to Step 1
  • An error gehts thrown:
    Could not convert target type "DateTime": No converter found which can be used to convert from "__PHP_Incomplete_Class" or "object" to "DateTime".

Possible solutions

  • The error definitely has something to do with Neos.Form/Classes/ViewHelpers/Form/DatePickerViewHelper.php and the getSelectedDate method (or the convert happening inside this method [Line 118])
  • Unfortunately it isn't completely clear to me why this error is thrown in the first place. A possible workaround would be to json_encode and json_decode the $date and then pass it to the convert.
// possible workaround in Neos.Form/Classes/ViewHelpers/Form/DatePickerViewHelper.php:118
$dateObject = json_decode(json_encode($date), true);
$date = $this->propertyMapper->convert($dateObject, 'DateTime');

Environment
neos/form: 5.2.0
neos/neos: 5.3.0
neos/flow: 6.3.0
php: 7.3

@sorenmalling
Copy link
Contributor

Can you confirm or deny if it's the issue described in this ticket #126

@anianweber
Copy link
Author

anianweber commented Mar 16, 2021

Yes, this is exactly the same issue.
Tanks for the fast response. This issue can be closed then.
Is there a plan when the next release will occur?
Or is the release 5.2.0 a false release? Should i instead downgrade to 5.1.2. This seems to be a newer release than 5.2.0.

@bwaidelich
Copy link
Member

Or is the release 5.2.0 a false release?

Good question. @daniellienert and @Sebobo you tagged the last releases, do you know more?

@Sebobo
Copy link
Member

Sebobo commented Mar 16, 2021

I still have to do the release was too busy yesterday

@anianweber
Copy link
Author

Tanks for the release! @Sebobo

bwaidelich added a commit that referenced this issue Aug 5, 2021
This fixes a regression introduced with #101 that prevented
objects like images and documents to be persisted in the
Form State, leading to exceptions in multi step forms.

Fixes: #143
Related: #126 #135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants