0

我正在使用 Zend Framework 2 中的 TableGateway。我的问题是我无法让函数之间的工作。

这是我现在拥有的代码,输出什么都没有:

public function fetchBetween($startDate, $endDate)
{
    $where = new Where();
    $where->between('date', $startDate, $endDate);

    $resultSet = $this->tableGateway->select($where);
    return $resultSet;
}

我正在调用此函数来获取两个日期之间的日期。

$this->getCalendarTable()->fetchBetween('4-04-2014', '30-05-2014');

PHPMyadmin 表

这是它必须的查询,并且在 phpmyadmin 中它正在返回数据,因此查询或数据库没有任何问题:

SELECT * FROM `klj_agenda` WHERE date BETWEEN '1-05-2014' AND '30-05-2014'
4

2 回答 2

1

我也在使用 TableGateWay,我绝不是专家,并且从 Ralf Eggert 的书中“窃取”了代码。他总是使用 tableGateWay->selectWith($select) 并且这有效。你的代码有什么区别,我需要调查。

于 2014-06-15T06:46:13.923 回答
0

问题是查询:2014-05-01 而不是 01-05-2014

于 2014-06-15T10:54:04.117 回答