$select = $this->getSql()->select();
$where = $this->getWhere()
->equalTo('campaign_id', $campaign->getId())
->between(new DbExpression('NOW()'), 'start_date', 'end_date');
$select->from('funding_round')
->columns(
array(
'funding_round_id',
'campaign_id',
'start_date',
'end_date',
'pledge_goal',
'created',
)
)
->where($where);
Produces:
SELECT `funding_round`.`funding_round_id` AS `funding_round_id`,
`funding_round`.`campaign_id` AS `campaign_id`,
`funding_round`.`start_date` AS `start_date`, `funding_round`.`end_date` AS
`end_date`, `funding_round`.`pledge_goal` AS `pledge_goal`,
`funding_round`.`created` AS `created` FROM `funding_round` WHERE
`campaign_id` = '4' AND BETWEEN 'start_date' AND 'end_date'
The part that's incorrect is
*AND BETWEEN 'start_date' AND 'end_date' *
*
*
should be
*AND NOW() BETWEEN 'start_date' AND 'end_date'*
*
*
But I'm not sure if it's my misuse of the class or a bug, help?