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
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
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
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'
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