简体   繁体   English

Zend框架2:TableGateway

[英]Zend Framework 2: TableGateway

I am using the TableGateway from Zend Framework 2. My problem is that I cannot get the between function to work. 我正在使用Zend Framework 2中的TableGateway。我的问题是我无法使函数之间正常工作。

This is my code that I have for now, the output is just nothing: 这是我现在的代码,输出内容一无所有:

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

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

I am calling this function to get the date between two dates. 我正在调用此函数以获取两个日期之间的日期。

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

PHPMyadmin表

This is the query that it has to be and in phpmyadmin it is giving back data so there is nothing wrong with the query or the databank: 这是必须执行的查询,在phpmyadmin中它正在返回数据,因此查询或数据库没有任何问题:

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

I'm also using TableGateWay, and I'm by no means an expert and have 'stolen' the code from a book by Ralf Eggert. 我也使用TableGateWay,但我绝不是专家,而是从Ralf Eggert的书中“窃取”了代码。 He is always using tableGateWay->selectWith($select) and this works. 他一直在使用tableGateWay-> selectWith($ select),并且可以正常工作。 What the difference is with your code, I would need to investigate. 您的代码有什么不同,我需要进行调查。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM