kevingoos
kevingoos

Reputation: 4343

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.

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 table

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:

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

Upvotes: 0

Views: 444

Answers (2)

kevingoos
kevingoos

Reputation: 4343

The problem was the query: 2014-05-01 instead of 01-05-2014

Upvotes: 0

Sybrand Bakker
Sybrand Bakker

Reputation: 19

I'm also using TableGateWay, and I'm by no means an expert and have 'stolen' the code from a book by Ralf Eggert. He is always using tableGateWay->selectWith($select) and this works. What the difference is with your code, I would need to investigate.

Upvotes: 1

Related Questions