0

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

Mateng
  • 3,742
  • 5
  • 37
  • 64
  • @froemken added a link to a test extension: "Here is my test extension: https://www.dropbox.com/s/rvnxzr75xvxmvyq/sfinvestigator_0.0.1.zip Please tell me what I have done wrong or missunderstood." Thanks for that. – Mateng Jul 16 '13 at 21:58

3 Answers3

2

I found the culprit in the model definition in Classes/Domain/Model/Inquiry.php

/**
 * @var Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Investigator>
 */
protected $investigator;

I changed (part of) the @var annotation to name space style:

/**
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tx_MyExt_Domain_Model_Investigator>
 */
protected $investigator;

Now the update process works. I guess in our project we need to standardize the model to name spaces. If this is a bug, I will file it at forge.typo3.org.

Mateng
  • 3,742
  • 5
  • 37
  • 64
1

This is currently a known problem in the 6.* branches of TYPO3.

See http://forge.typo3.org/issues/54289 there is currently a patch pending to get this fixed.

minifranske
  • 1,295
  • 6
  • 12
0

I have tested it with TYPO3 6.1 and TYPO3 6.2-dev from GIT and can't reproduce this problem. So it would be nice if you can give up some environment informations. Please start with your current TYPO3-Version.

froemken
  • 412
  • 2
  • 7
  • 1
    This ought to be a comment, not a question – Darius X. Jul 16 '13 at 19:38
  • Correction: *not an answer ;). – Mateng Jul 16 '13 at 19:49
  • It's my first time here and I don't know everything. I see a share and edit link, but I don't see how to add a comment or question regarding this thread. So the nearest option was to add an answer. – froemken Jul 16 '13 at 20:10
  • Thanks a million, froemken. The principle here is: Only answer a question if you can provide a solution to the problem. To envolve in the discussion, use the "comment" link below each question/answer. It's quite useful, because the best/correct solution is always shown on top, and the discussion doesn't lose focus. – Mateng Jul 16 '13 at 22:01