The object of type "<Model>" given to update must be persisted already, but is new.
The first time this bug appeared is in TYPO3 10. It was working properly in previous versions (I tested TYPO3 9 and 8 as well).
I have a FrontendUser validation in my Controller. When I edit that user and enter invalid data, an validation error is displayed. So far so good. Then I enter valid data and now I get the exception:
The object of type "TYPO3\CMS\Extbase\Domain\Model\FrontendUser" given to update must be persisted already, but is new.
What happens is that after the model was validated with the invalid state, the form looses the frontend user identifier.
This bug is critical, as once you enter invalid data into a form, there is no more way to save the form.
Attached an extension to try it out.
Create a page, create frontend user group and frontend user, select the new object type, add the typoscript template, set the persistence id in the constants file and add the plugin to the page. Then you can replicate the bug.
In the attached extension the HTML snippet '<input type="hidden" name="tx_frontenduserexample_frontenduserexample[user][__identity]" value="1">'
gets lost in the form.
#8 Updated by Riccardo De Contardi 28 days ago
- Status changed from New to Closed
@Simon Schaufelberger thank you for your quick reply; this ticket is closed in agreement with the reporter.
If you think that this is the wrong decision or experience the issue again please reopen it or open a new ticket with a reference to this one.