[TYPO3-german] mehrere Objekte einer Klasse aus einem Formular speichern

Christof Schmidt christof_schmidt at gmx.de
Wed Oct 12 13:25:41 CEST 2016


Hallo
Ich bin ziemlich neu bei typo3 und stehe gerade total auf dem Schlauch.
Ich möchte mehrere Einträge aus einem Formular aus einer foreach-Schleife speichern.

[code]
<h1>{headline}</h1>

<f:render partial="Error" arguments="{object:'timeofday'}" /> 

<h3>{survey.title}</h3>

<f:form action="{action}" object="{timeofday}" name="timeofday" arguments="{survey:survey, appiontment:appiontment}" additionalAttributes="{role:'form'}">

<f:for each="{survey.appiontments}" as="appiontments">
<li class="list-group-item">
<label>{appiontments.appiontmentdate}</label>
<f:form.textfield property="timevalue" type="time" class="form-control" id="{appiontments}" />
</li>

</f:for>

<f:form.submit value="{submitmessage}" class="btn btn-primary" />

</f:form>

[/code]


Mein aktueller Controller speichert jetzt natürlich nur den letzten Wert.
Ich komme aber einfach nicht drauf wie ich jetzt weiter verfahre.


[code]
/**
* @param \Schmidtch\Survey\Domain\Model\Survey $survey
* @param \Schmidtch\Survey\Domain\Model\Appiontment $appiontment
* @param \Schmidtch\Survey\Domain\Model\Timeofday $timeofday
*/
public function addAction(
\Schmidtch\Survey\Domain\Model\Survey $survey,
\Schmidtch\Survey\Domain\Model\Appiontment $appiontment,
\Schmidtch\Survey\Domain\Model\Timeofday $timeofday) 
{	
$appiontment->addTimeofday($timeofday);	
$this->objectManager->get('Schmidtch\\Survey\\Domain\\Repository\\AppiontmentRepository')->update($appiontment);
$this->redirect('show','Survey',Null,array('survey'=>$survey));
}
[/code]


More information about the TYPO3-german mailing list