Re: Recursion for my own custom query?

2007-06-19 Thread AD7six
On Jun 18, 3:03 pm, Joshua Benner [EMAIL PROTECTED] wrote: Looks good. I think I would use Cake's magic before writing my own function like that, Cake doesn't change the rules as far as DBs go. If creating an extra table model to avoid writing a GROUP BY statement with some date functions

Re: Recursion for my own custom query?

2007-06-18 Thread Joshua Benner
Consider using a 'Months' table for which you define a 'Month' model which has associations defined between it and 'Entry' Then: $this-Month-findAll(array('monthName'='January')) Pete wrote: I have a function in my model, to get a list of the months that I have blog entries in: function

Re: Recursion for my own custom query?

2007-06-18 Thread AD7six
On Jun 18, 1:55 pm, Joshua Benner [EMAIL PROTECTED] wrote: Consider using a 'Months' table for which you define a 'Month' model which has associations defined between it and 'Entry' Then: $this-Month-findAll(array('monthName'='January')) Or not :). http://bin.cakephp.org/saved/20574

Re: Recursion for my own custom query?

2007-06-18 Thread Joshua Benner
Looks good. I think I would use Cake's magic before writing my own function like that, though. However, the function also accomplishes more than the initial target functionality. AD7six wrote: On Jun 18, 1:55 pm, Joshua Benner [EMAIL PROTECTED] wrote: Consider using a 'Months'

Recursion for my own custom query?

2007-06-17 Thread Pete
I have a function in my model, to get a list of the months that I have blog entries in: function getMonths($limit = null) { $sql = SELECT DISTINCT month(Entry.date) number, monthname(Entry.date) title, year(Entry.date) year FROM entries as Entry ORDER BY date DESC; if ($limit): $sql .= LIMIT