[TYPO3-mvc] edit multiple objects in one form

Johannes C. Schulz - EnzephaloN IT-Solutions info at enzephalon.de
Tue Feb 21 09:31:03 CET 2012


Hello Lorenz
I tried your workaround to solve a problem similar to yours, but I get an
error " Fatal error: Call to undefined method
Tx_Extbase_Persistence_QueryResult::setAccepted() in
F:\Kunden\xampp\htdocs\psoa\typo3conf\ext\psoa_accredit\Classes\Controller\B
ackendController.php on line 133".
133: if(!$person['denied']) $personObject->setAccepted(1);
Do you have an idea about that?
Best regards
Johannes


-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Lorenz Ulrich
Gesendet: Donnerstag, 17. November 2011 17:37
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] edit multiple objects in one form

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:
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc




More information about the TYPO3-project-typo3v4mvc mailing list