3070 Posts in 869 Topics by 651 members
|Go to End|
14 June 2011 at 3:00pm
I've been using the DataObjectSet function 'groupWithParents()' with some limited success on my site. Basically, the problem I've run into is that the function seems to be failing without any errors when the dataobject has no matching results. Here's the code in the custom function I'm running:
$grouped = $this->Expertise()->groupWithParents('ParentID','ExpertisePage');
Where: $this->Expertise() is a many_many relationship.
This function works if $this->Expertise() contains items whose Parent->ClassName = 'ExpertisePage', but fails if ALL items Parent->ClassName != 'ExpertisePage'. I've tried a Try/Catch block, but no exception occurs. I've also tried setting the collapse parameter to 'true', but still no go!
There seems to be very little information about this function apart from the basics found in the API.
Anyone had any experience with this, or should I submit it as a bug?
Thanks in advance
Here's a brief explanation of what I'm trying to achieve. In the CMS we have a page which has a multi-select-tree-dropdown control for assigning 'Expertise' areas (pages in the site tree of ClassName 'ExpertisePage'). This all works fine. In the frontend, I can control-output these Expertise items in a simple <ul> style nav. I'm now trying to group these expertise links in a nice 2-level <ul> list so if a sub-level Expertise is assigned to the page, it will show up under it's Expertise parent. It needs to be able to work for multiple sub-levels and group them with their parent only once.
- Expertise Parent (not assigned to page, but included because sub's are assigned)
- Expertise Sub1 (assigned to page)
- Expertise Sub2 (assigned to page)
- Expertise Parent (assigned to page)
|Go to Top|