Closed (fixed)
Project:
Crumbs, the Breadcrumbs suite
Version:
7.x-1.0-alpha4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Feb 2012 at 15:59 UTC
Updated:
8 Nov 2012 at 22:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
donquixote commentedOk, good luck fixing that :)
(i might look into it another day, but i use mysql, so maybe you want to help)
Comment #2
donquixote commentedHere is what the code wants to achieve:
If there are multiple hits, it should just pick the first it can find.
For numeric columnbs I could do a MAX, but for string fields?
Maybe in this case the GROUP BY is not needed at all. Still, some other situations made me paranoid, so I added the GROUP BY to prevent any duplicates.
Any idea?
------
For now I'd say we do it with PHP instead of mysql.
Remove the GROUP BY, and instead use PHP to pick the first element in an array.
Btw, this inspired me to explore some crazy way of picking the first element of an associative array.
Result:
Crazy nice, isn't it?
Yes, there are other ways to pick the first element of an associative array. If you have some nice suggestion, let me know.
I just read that reset() is not reliable, http://www.php.net/manual/de/function.reset.php#96090
---------------
Now, applying that to menu_CrumbsMultiPlugin_hierarchy::findParent()
Anyone willing to test this?
(not in patch mood today)
Comment #3
donquixote commentedThis should be fixed now.
Comment #5
donquixote commentedThe "solution" here is ugly and awkward.
Let's do something equivalent to #1788214-4: Crumbs compatibility issue with PostgreSQL instead.
Comment #6
donquixote commentedHere is a patch to make this look nicer.
Comment #7
bojanz commentedLooks good.
Comment #8
donquixote commentedThe awkward code is history :)