Hallo,
ich arbeite gerade an einer Extension auf Basis von Extbase/FLuid.
Genau gesagt eine Geräteverwaltung.
Ich habe dafür eine Tabelle Device und eine Tabelle Devicetype
in der Tabelle Devicetype werden die unterschiedlichen Gerätetypen gespeichert (Drucker, Scanner, Plotter, etc.)
Jetzt möchte ich das im Edit View des Devices die Devicetypes als Selectbox angezeigt werden. Dies habe ich geschafft leider passiert beim Update des Devices etwas merkwürdiges wärend alle anderen Werte gespeichert werden passiert bei dem Devicetype garnix ich bekomme die Message das das Device geupdatet wurde das wars.
Wenn ich mir den Devicetype ansehe steht der selbe Wert wie vorher drin.
Eventuell kann mir einer von euch sagen wo mein Denkfehler liegt.
Daher Poste ich hier die Betrefenden Stellen mal.
Edit und Update Action des DeviceControllers
public function updateAction(Tx_MyExt_Domain_Model_Device $device) {
$this->deviceRepository->update($device);
$this->flashMessageContainer->add('Your Device was updated.');
$this->redirect('index');
}
public function editAction(Tx_MyExt_Domain_Model_Device $device) {
$devicetypes = $this->devicetypeRepository->findAll();
$this->view->assign('devicetypes', $devicetypes);
$this->view->assign('device', $device);
}
Der EditView des Devices
<f:form method="post" action="update" name="device" object="{device}">
<f:for each="{device.devicetype}" as="devicetype" >
<f:form.select property="devicetype" options="{devicetypes}" optionLabelField="name" optionValueField="uid" value="{devicetype.uid}" size="1" />
</f:for>
</f:form>
soweit alles gut es wird folgender htmlcode generiert
<form method="post" name="device" action="index.php?id=5&tx_myext_pi1[action]=update&tx_myext_pi1[controller]=Device&cHash=abcdee1b5478c149">
<select size="1" name="tx_myext_pi1[device][devicetype]">
<option value="1">Scanner</option>
<option value="2" selected="selected">Drucker</option>
</select>
...
</form>
Nach meiner Theorie sollte beim Absenden des Formulares der Value übergeben werden was er laut Http LiveHeaders auch tut, allerdings wird der Wert nicht gespeichert.
Meine Vermutung da im Device Model der devicetype als PersistensObject definiert, aber eine Zahl übergeben wird. Nur weiß ich gerade nicht wie ich statt der Zahl das Object bekomme bzw. übergebe.
Ausschnitt DeviceModel
/**
* devicetype
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Devicetype> $devicetype
*/
protected $devicetype;
/**
* Setter for devicetype
*
* @param Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Devicetype> $devicetype
* @return void
*/
public function setDevicetype(Tx_Extbase_Persistence_ObjectStorage $devicetype) {
$this->devicetype = $devicetype;
}
/**
* Getter for Devicetype
*
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Devicetype> devicetype
*/
public function getDevicetype() {
return $this->devicetype;
}
Eventuell hat ja jemand von euch eine Idee.
Danke schon mal im Voraus
Gruß typonewbe