Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Listing 2 DataObjectSets

Go to End

3 Posts   528 Views


Community Member, 24 Posts

11 February 2012 at 7:52pm

Howdy, I have created 2 DataObjects Rewards and Redemptions. I would like to display them on a single list sorted by their created field.

Here is the code doing the work;

function getRewardRedemptions() {	
	$doSet = new DataObjectSet();

	if($Rewards = DataObject::get('Rewards',"MemberID={$this->Member->ID}")) {
	if($this->Member && $Redemptions = DataObject::get('Redemptions',"MemberID={$this->Member->ID}")) {
	return $doSet;

It all works a-ok with one small hick up the list is grouping the Objects. So all the rewards and the redemptions are sitting together. What I would like to happen is the rewards and redemptions to be intertwinned.

I'm pretty certain there is one little tweak I need to make so it all falls into place.

Any help would be greatly appreciated.


Forum Moderator, 1203 Posts

12 February 2012 at 1:06am

What you are doing should work - at least within your getRewardRedemptions function itself. Did you do a var_dump there, or a foreach echo?

What does your template look like? (the bit that handles getRewardRedemptions)?


Community Member, 24 Posts

12 February 2012 at 11:51pm

Thanks Martimiz, It turns out the problem was mine. Although the redemption has a created field there was also a sent date. So it was working correctly.

I did a var_dump I could see that the Created field was way back when. Once I started using the correct date field all was sweet.

Thanks again.