empty WHERE statement since 2.1

For programming and general questions on Zend Framework
Post Reply
Posts: 1
Joined: Thu Aug 23, 2012 6:29 pm

empty WHERE statement since 2.1

Post by radykal » Sun Feb 17, 2013 8:47 pm


got some code running from ZF 2.0.3 to ZF 2.0.6, but after upgrade to 2.1.1 it stopped working, i have some SELECT queries with a DATE_FORMAT in the WHERE clause and its not working anymore in all queries that implement it ( i have it on 3 different queries and all 3 are doing the same).

For example:

Code: Select all

$sql = $this->getSql();
        $select = $this->buildDefaultSelect();

        $select ->where("DATE_FORMAT(date, '%Y') = $year")
                       ->order('date DESC');
is building the following SQL query:

SELECT `blog_posts`.*, `users`.`name` AS `name`, `blog_categories`.`name` AS `cat_name`, `blog_categories`.`alias` AS `cat_alias`, `blog_categories`.`icon` AS `cat_image` FROM `blog_posts` INNER JOIN `users` ON `blog_posts`.`id_user` = `users`.`id` INNER JOIN `blog_categories` ON `blog_posts`.`id_category` = `blog_categories`.`id` WHERE ORDER BY `date` DESC, `date` DESC"

As you can see, the WHERE Clause is empty, it was working fine to 2.0.6. What has changed since then and how to solve it?

Thanks you,

Post Reply