[TYPO3-mvc] Recent change in method argument handling
Ingmar Schlecht
ingmar at typo3.org
Fri Aug 21 12:28:08 CEST 2009
Xavier Perseguers schrieb:
> Hi,
>
>> I had this in my controller:
>>
>> public function searchAction($lastName, $firstName, $street) {
>>
>> }
>>
>> and before my holidays (10th August), I was able to post data to the
>> search action using POST variables containing the search criteria
>> (which could be empty). E.g.,
>>
>> POST /path/to/page/containing/controller
>> lastName
>> firstName Xavier
>> street
>>
>> Meaning I'm searching all "Xavier".
>>
>> This worked. Now I get these errors instead:
>>
>> Error: Required property 'lastName' does not exist.
>> Error: Required property 'firstName' does not exist.
>> Error: Required property 'street' does not exist.
>>
>> I tried to change my definition to
>>
>> public function searchAction($lastName = NULL, $firstName = NULL,
>> $street = NULL) {
>>
>> }
>>
>> But this time my POST parameters are not passed anymore, meaning all
>> parameters received by searchAction are NULL.
>
> Digging into subversion logs, I found that this patch was applied:
> http://forge.typo3.org/attachments/1472/3316_POST_arguments_must_be_namespaced.patch
>
>
> Meaning both GET and POST parameters are now namespaced (I thought about
> this). Meaning I have to change my POST parameters from
>
> lastName
> firstName
> street
>
> to
>
> tx_<extension>_<plugin>[lastName]
> tx_<extension>_<plugin>[firstName]
> tx_<extension>_<plugin>[street]
>
> But I now have to find a way to get this when playing with ExtJS as I
> need this:
>
> ds.load({
> params: {
> lastName: search_view.findById("lastName").getValue(),
> firstName: search_view.findById("firstName").getValue(),
> street: search_view.findById("firstName").getValue(),
> },
> callback: Members.searchCompleted
> });
>
> But I cannot replace lastName with tx_myext_search[lastname] as this
> later is not a valid name for an object property...
What about putting the name of the object property in quotes? I think
you can use anything you like then.
E.g.:
ds.load({
params: {
'tx_myext_search[lastName]': ...,
'tx_myext_search[firstName]': ...,
'tx_myext_search[street]': ...,
},
callback: Members.searchCompleted
});
...although that arguably doesn't look as nice anymore.
cheers
Ingmar
More information about the TYPO3-project-typo3v4mvc
mailing list