Search code examples
phpzend-framework2where-clausebetweentablegateway

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'

Solution

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