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

Christian Essl essl at incert.at
Tue Oct 4 13:54:02 CEST 2011


Yes, also the getter-method. 

-----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 13:37
An: TYPO3 v4 MVC project
Betreff: Re: [TYPO3-mvc] fluid selector - Argument passed to x must be an instance of y, string given

And you changed type also for the "protected $ausbildungsSchwerpunkt" property?

Claus

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

> Yes. I always clear the cache, when I changed the model.
> 
> -----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 13:33
> An: TYPO3 v4 MVC project
> Betreff: Re: [TYPO3-mvc] fluid selector - Argument passed to x must be 
> an instance of y, string given
> 
> Cache cleared too? Extbase stores class reflections in cache.
> 
> On Oct 4, 2011, at 1:31 PM, Christian Essl wrote:
> 
>> Hi,
>> 
>> Thanks for the tip. I tried to add "= NULL" in the setter, but it still throws the same error. After that  I changed the expected type to  string:
>> 
>> 	/**
>> 	 * Sets the ausbildungsSchwerpunkt
>> 	 *
>> 	 * @param string $ausbildungsSchwerpunkt
>> 	 * @return void
>> 	 */
>> public function setAusbildungsSchwerpunkt(string 
>> $ausbildungsSchwerpunkt = NULL) {
>> 
>> Now it still throws the same error with " must be an instance of string, string given"...
>> 
>> 
>> -----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 13:21
>> 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,
>> 
>> 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-typo3
>>>> v
>>>> 4
>>>> mvc
>>> 
>>> _______________________________________________
>>> TYPO3-project-typo3v4mvc mailing list 
>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v
>>> 4 m vc _______________________________________________
>>> TYPO3-project-typo3v4mvc mailing list 
>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v
>>> 4
>>> m
>>> vc
>> 
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list 
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4
>> m vc _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list 
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4
>> m
>> vc
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
> vc _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
> vc

_______________________________________________
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