Project

General

Profile

Task #99451

Updated by Sybille Peters over 1 year ago

h2. Problems 

 1. The order is reversed: the values in ->inSet which are passed to FIND_IN_SET are reversed 
 2. argument names do not clearly reflect what is needle, what is haystack, what is the comma separated list 
 3. PHPDoc is vague, possibly also vague and misleading: 

 > $fieldName The field name. 
 > string $value Argument to be used in FIND_IN_SET() comparison.  

 4. Possibly it might be good ideat to rename the function name (or create a new one and deprecate the old) as it is not a simple FIND_IN_SET, it is a FIND_IN_SET where the haystack is a fieldname which contains a comma separated list of values  

  


 h2. Suggestions 

 To mitigate this, I think at least the following should be done: 

 - function argument names should be named in a way which makes it intuitive. For example, use names such as "needle" and "haystack" or "pattern" and "fieldList" as is customary in PHP and / or SQL. 
 - make PHPDoc more specific if helpful in addition to argument names. Remove explanations which only repeat the name of the argumen. E.g. "field name" as explanation for fieldName is unnecessary fluff. 
 - possibly improve documentation: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Database/ExpressionBuilder/Index.html#comparisons. Apply same principles here.

Back