[TYPO3-mvc] edit multiple objects in one form
Lorenz Ulrich
lorenz-typo3 at visol.ch
Thu Nov 17 17:37:12 CET 2011
Hi everyone
If anyone else is interested, I just to let you know about the
approach/workaround I took in the meantime:
I iterate over all related objects (here: artistical works) of a user
and create the fields like this:
<f:form.textfield name="work[{work.uid}][creationyear]"
value="{work.creationyear}" />
I submit the form to the multiUpdateAction in my controller that
iterates on the request and updates the value for each object:
$works = $this->request->getArgument('work');
foreach ($works as $uid => $work) {
$work['uid'] = $uid;
$workObject = $this->workRepository->findByUid($uid);
$workObject->setTitle($work['title']);
$workObject->setCreationyear($work['creationyear']);
$workObject->setDescription($work['description']);
$workObject->setVisibility($work['visibility']);
$workObject->setSorting($work['sorting']);
}
Might be a bit hacky, but works. I'm using it for an IRRE-like frontend
where the user can sort and edit his works in a JQuery sortable accordion.
Best regards,
Lorenz
Am 17.11.2011 15:14, schrieb Lorenz Ulrich:
More information about the TYPO3-project-typo3v4mvc
mailing list