3.1 #46

Merged
merged 3 commits into from Dec 30, 2013

Projects

None yet

2 participants

@arambalakjian

No description provided.

@arambalakjian arambalakjian merged commit ddd904b into master Dec 30, 2013
@aledbrown

Hi Aram

Happy New Year :)

I applied this latest DOAP update to a SS 3.1.2 implementation. My filters stopped working. However, I caveat that by saying I don't understand what the "new Filter Module" is.

For example in SS3.1.2/DOAP before 5b17acb was merged this subclass override used to work:

public function getItemsWhere()
{
    //Use this function to return a custom filter to the Items() function
    return "EmbargoDate <= CURDATE() AND EmbargoDate <= ExpiryDate";
}

But now it throws add item array errors.

It doesn't matter if I simplify the return it still doesn't work. Only commenting getItemsWhere() out completely lets the page work again (desired filters are then off, of course).

Could you post a quick example of the new Filter Module syntax and how to override it from List Holder pages? Or is something else going on?

Many thanks
Aled

@arambalakjian

Hi Aled,

Yea this change wa4s to bring it inline with the new DataList->filter() in SS3, instead of the where syntax that was used in DataObject::get() of 2.4

Essentially you now pass in an array to insert into filter(), take a look at the way the filter module does it here:

https://github.com/arambalakjian/DataObject-as-Page-Filter/blob/master/code/Pages/FilteredListingPage.php#L134

Shouldn't be too hard to work in your where in this format.

Essentially try to get it working on it's own as a YourClass::get()->filter(array($Var => $Value));

Then take the bit inside the filter() and return that from your getItemWhere() function.

Hope that helps!

Aram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment