[TYPO3-mvc] Warning: Unknown class passed as parameter and cache problem
Xavier Perseguers
typo3 at perseguers.ch
Sun Sep 13 18:41:45 CEST 2009
Hi,
>> I have this method signature:
>>
>> /**
>> * Returns a list of persons corresponding to search criteria.
>> *
>> * @param string $lastName
>> * @param string $firstName
>> * @return string The rendered view
>> */
>> public function searchAction($lastName, $firstName) {
>>
>> }
>
> I tried to create a domain object holding lastname and firstname and
> changed the signature to
>
> public function searchAction(Tx_MySearch_Domain_Model_Criteria $criteria)
>
> but now I get
>
> Catchable fatal error: Argument 1 passed to
> Tx_MySearch_Controller_PersonController::searchAction() must be an
> instance of Tx_MySearch_Domain_Model_Criteria, array given in ...
After a break, I changed my domain object to be a simple array (no more object class in fact) but
public function searchAction(array $criteria).
> My POST parameters seem valid though:
>
> tx_mysearch_person[__referer][actionName] search
> tx_mysearch_person[__referer][controllerName] Person
> tx_mysearch_person[__referer][extensionName] MySearch
> tx_mysearch_person[criteria][firstName]
> tx_mysearch_person[criteria][lastName] perseguers
This works great. once __referer items are there. No more warnings as said in my first message but cache problem persists.
Finally I changed how the plugin was rendered. As for other mvc_extjs samples, I use a special pagetype (with a time()-based typeNum):
// From mvc_extjs
ajax = PAGE
ajax {
# You don't need to change this typeNum
typeNum = 1249058000
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
xhtml_cleaning = 0
admPanel = 0
}
}
In my extension:
mysearch_persons_search < ajax
mysearch_persons_search {
typeNum = 1249241029
10 < tt_content.list.20.mysearch_persons
}
Adding
ajax.config.no_cache = 1
solves the cache problem. What is odd is that the tt_content.list.20.mysearch_persons is a USER (thus cached) and becomes a USER_INT with the TS generated by Extbase:
[globalString = GP:tx_mysearch_persons|controller = Person] && [globalString = GP:tx_mysearch_Persons|action = /search/]
As the URL is
http://localhost/search.html?type=1249241029&tx_mysearch_persons%5Baction%5D=search&tx_mysearch_persons%5Bcontroller%5D=Person&tx_mysearch_persons%5Bformat%5D=xml&cHash=dbae8f35648a7c697d565b654594c29f
The condition should become active but it seems it does not work...
After all, and without really understanding why I had this problem (if someone could explain it would be great), I found out that forcing
mysearch_persons_search.10 = USER_INT
does the job without having to add an ugly "no_cache = 1" in ajax.config.
--
Xavier Perseguers
http://xavier.perseguers.ch/en
One contribution a day keeps the fork away
More information about the TYPO3-project-typo3v4mvc
mailing list