Broken SQL Query when creating an own LabelRenderer
When programming an own label renderer a SQL Query is generated which fails.
The generated query in my case (for website users) was:
The problem is this piece of generated code: where display_name as label like
This should only be: where display_name like
I already found a solution for this:
The /preside/system/services/admin/DataManagerService.cfc, function getRecordsForAjaxSelect() need the following change:
the selectfields already maybe contain a 'as' string. So selecting the first word (which is only the fieldname) is a solution.
PS: I have to apologize, that I still haven't installed my system to do a pull request. And I also don't know if the solution I found is completely valid and I think it can be done much more elegant. But hey, it works.
I'd be happy if someone do a pull request for this. He can have all the kudos.
Thanks - will be available in the next snapshot of 10.9...
And another example, matching the website_user issue mentioned. My website_user_extended.cfc label renderer is showing some more informationen like the address, etc. If you start searching the query fails.
Sure. Please find attached the two files.
first a preside-object/catgegories.cfc which offers the possibility to generate hierarchical categories.
and the handlers/renderers/labels/categories.cfc which is generating a label like "Root > Level 1 > Level 2 > Level 3".
Whitout the change explained above the rendering of the labels fails.
Just so I can check this properly, could you please provide the label renderer code that is generating the bad SQL?