I am developing an extension (Typo3 13.4.25) and need a custom receiverClass for the suggestWizard of a group type column.
Everything works fine so far, but the generated sql statement throws an error.
Here is debug output of queryBuilder->getSQL() and getParameters() right before the executeQuery:
component="KBM.Genealogy.UserFuncs.PersonSuggestReceiver":
Executing query for PersonSuggestReceiver -
{"sql":"SELECT `tx_genealogy_domain_model_person`.* FROM `tx_genealogy_domain_model_person`
WHERE (`tx_genealogy_domain_model_person`.uid <> 3)
AND (`label_name` LIKE ? ESCAPE '\\\\')
AND (`pid` IN (14))
AND (`tx_genealogy_domain_model_person`.`gender` = :dcValue2)
AND (`tx_genealogy_domain_model_person`.`birth_year` > :dcValue3)
AND (`tx_genealogy_domain_model_person`.`birth_year` < :dcValue4)
AND (((`tx_genealogy_domain_model_person`.`deleted` = 0)
AND (((`tx_genealogy_domain_model_person`.`t3ver_wsid` = 0)
AND (((`tx_genealogy_domain_model_person`.`t3ver_oid` = 0)
OR (`tx_genealogy_domain_model_person`.`t3ver_state` = 4)))))))
ORDER BY `label_name` LIMIT 50"}
component="KBM.Genealogy.UserFuncs.PersonSuggestReceiver": Query parameters -
{"parameters":{"0":"%na%","dcValue2":"f","dcValue3":1930,"dcValue4":2005}}
That looks exactly as expected (I entered “na” as search string), but the following executeQuery throws an exception:
component="TYPO3.CMS.Core.Error.DebugExceptionHandler":
Core: Exception handler (WEB: BE):
Doctrine\DBAL\Exception\SyntaxErrorException, code #1064,
file /var/www/html/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php, line 78:
An exception occurred while executing a query:
You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the right syntax to use near
':dcValue2) AND (`tx_genealogy_domain_model_person`.`birth_year` > :dcValue3) ...' at line 1
...
It looks like the placeholders dcValue are not replaced before the sql statement is executed.
If I pass them without queryBuilder->createNamedParameter(..) to the queryBuilder the query is valid.
As far as I understood the documentation, the placeholders should be replaced in $queryBuilder->executeQuery().
Thanks in advance for any hints,
Karl