I have a m:n relation in my domain model:
- inquiry is the aggregate root in my domain model
- several investigators can be assigned to each inquiry.
In the inquiry model this is defined:
/**
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Investigator>
*/
protected $investigator;
The investigator domain model is mapped to the fe_user table of TYPO3, which is noted properly in the configuration (ext_typoscript_setup.txt
):
config.tx_extbase{
persistence{
classes{
Tx_MyExt_Domain_Model_Investigator {
mapping {
recordType = Tx_Extbase_Domain_Model_FrontendUser
tableName = fe_users
}
}
}
This works fine, I can display and edit inquiry records in the backend and frontend. However, when I want to change the investigators assigned to one inquiry (from edit action), I get an exception after submitting my form:
#1297759968: Exception while property mapping at property path "investigator":
No converter found which can be used to convert from "array" to
"Tx_Extbase_Persistence_ObjectStorage"
The multiselect-box that I use for this is created like that:
<f:form.select multiple="true" size="10" property="investigator"
value="{inquiry.investigator}" options="{allInvestigators}"
optionLabelField="name" />
Which is rendered like this:
<select name="tx_myext_inquiry[inquiry][investigator][]" size="10" multiple="true">
<option value="362">John Doe</option>
<option value="590">Jane Doe</option>
<option selected="selected" value="361">Steve Miller</option>
<option value="720">James Brown</option>
<option value="726">Janis Joplin</option>
</select>
{allInvestigators}
is an array with all users from the group "investigators".
The values already stored are marked with "selected", which proves that some of my code is correct ;).
I tried fiddling around with the type converter (Tx_Extbase_Property_TypeConverter_PersistentObjectConverter
Dok) in the InquiryController to cast my array to an object, but it to no avail. The field investigator is passed as an array to the update action, which triggers the exception.
I spend five hours on this now, need to move on.
- How can I get rid of this error message?
- Is converting the array to an object the right approach at all?
(Any questions for more details will be answered ASAP)
Edit:
Environment: TYPO3 version 6.1.1, Fluid 6.1.0, Extbase 6.1.0