[TYPO3-mvc] fluid selector - Argument passed to x must be an instance of y, string given

Claus Due claus at wildside.dk
Tue Oct 4 13:21:20 CEST 2011


Hi Christian,

uid is the default key. This sounds more like a problem with the property mapper. Could you check which value is being POST'ed to the controller? I suspect it could be an empty which causes this problem - in which case you should be able to get around it by allowing a default value of NULL in your setter: setAsbildungsschwerpunkt($punkt=NULL).

Hope this helps.

Claus


On Oct 4, 2011, at 1:03 PM, Christian Essl wrote:

> Hi,
> 
> I now added optionValueField:
> 
>      <f:form.select id="ausbildungsschwerpunkt" property="ausbildungsschwerpunkt"
>        options="{ausbildungsschwerpunkte}" optionLabelField="titel" optionValueField="uid">
>      </f:form.select>
> 
> But the problem is still the same. Shouldn't uid be the default key?
> 
> -----Ursprüngliche Nachricht-----
> Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Claus Due
> Gesendet: Dienstag, 04. Oktober 2011 12:47
> An: TYPO3 v4 MVC project
> Betreff: Re: [TYPO3-mvc] fluid selector - Argument passed to x must be an instance of y, string given
> 
> Hi Christian,
> 
> Would you be able to use {object.uid} as the value argument of the selector? That should prevent your object vs. string error message.
> 
> Kind regards,
> Claus
> 
> On Oct 4, 2011, at 12:27 PM, Christian Essl wrote:
> 
>> Hi,
>> 
>> I extended my fluid-formular to load in a foreign table and put it in a selector. Now when I try to save a new object with the formular, I get the following error:
>> 
>> PHP Catchable Fatal Error: Argument 1 passed to Tx_Extensionname_Domain_Model_Lehrgang::setAusbildungsSchwerpunkt() must be an instance of Tx_Extensionname_Domain_Model_Ausbildungsschwerpunkt, string given in ... Lehrgang.php line 448
>> 
>> This means the option-value from the selector (which is the uid) is treated a string, but extbase expects an object. I compared my code with the blog_example (where a list of administrators is loaded into a selector) but I can't figure out the difference. Everything from the controller, tot he form and model is done the same way...
>> 
>> The newAction and createAction look like this:
>> http://pastebin.com/sRBZqkCt
>> 
>> The model is very basic:
>> http://pastebin.com/npg7K5qJ
>> 
>> Regards,
>> Christian
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> 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