View more context

 

r3v3rb

@brett.tasker yep, I need to split the created dates first into year and month arraylists then I'll add all the orderitems and then group by month -> year

brett.tasker

I would probably do the splitting / grouping in PHP so that you are only requesting the raw data from Database once (As I am assuming you will be displaying all items within an accordian that is grouped).

I did something similar a few weeks ago but had to add additional information to the grouping so essentially had to loop results and create my own GroupedList manually.

NOTE: yield can be useful in helping to manage memory with this.

nightjarnz

GroupedList caveat: that'll be a lot of PHP side processing.

taoceanz

Is it possible to use PHP functions in a .ss file? I'm rendering a view file and passing an array of data but want to check whether certain values exist within the array before displaying a section in that view file. I thought using in_array() or isset() would be sufficient but it's behaving like the function isn't being run.

nightjarnz

@taoceanz the way around this is to put the logic where it best belongs - this is likely your controller (assuming a page, eg. PageController), but could also be a model, etc. e.g.

  1. public function getThingExists($list) {
  2. return $list->filter('Key', $thing)->exists();