[TYPO3-english] Problems with integer in SQL-statement of userfunc
Bert Hiddink [BENDOO e-work solutions]
hiddink at bendoo.nl
Tue Dec 2 10:57:20 CET 2014
Hello,
I have this snippet to count over selected news-items (tx_news):
...
35 = USER
35 {
userFunc = user_counter->getCounter
userFunc {
# whole string
selectedCategories=TEXT
selectedCategories.data=GP:tx_news_pi1|overwriteDemand|categories
selectedCategories.wrap=,{field:uid}
selectedPid={$categoriesPid}
}
}
...
Within the userfunc, I receive "selectedCategories" as fe "654,652,655"
where "655" is the field:uid from the wrap...
However, within the query, it does not return any valid result since
field:uid is not received as an integer...
If I hardcode $selectedCategories within the userfunc to fe
"654,652,655", the query returns the expected result...
Any ideas how to resolve this?
This is the query:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'count(*) as counter',
'(SELECT p3.uid, group_concat(mm3.uid_local)
FROM sys_category_record_mm mm3
INNER JOIN tx_news_domain_model_news p3 ON mm3.uid_foreign=p3.uid
INNER JOIN sys_category c ON c.uid=mm3.uid_local
WHERE p3.pid='.$selectedPid.' AND p3.deleted=0 and p3.hidden=0 and
mm3.uid_local in ('.$selectedCategories.')
AND p3.sys_language_uid='.$currentLanguage.' AND
c.sys_language_uid='.$currentLanguage.' group by mm3.uid_foreign
having count(distinct mm3.uid_local) >= '.$countedCategories.'
) as products',
'',
'',
'',
''
);
I tried with:
implode(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',',
$row['subgroup']), ',');
but this turns always the "field:uid" into "0". The SQL statement
returns then zero results obviously...
Any ideas will be highly appreciated!!!
Thanks and regards,
Bert
http://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/MainClasses/UsefulFunctions/Index.html
More information about the TYPO3-english
mailing list