Issues

ZF2-522: db query with experssion that returns an empty results, return one row with all columns eq to null

Issue Type: Bug Created: 2012-09-05T09:00:56.000+0000 Last Updated: 2012-10-08T20:16:33.000+0000 Status: Closed Fix version(s): Reporter: Kfir Ozer (kfirufk) Assignee: Ralph Schindler (ralph) Tags: - Zend\Db

  • Expression
  • Zend_Db

Related issues: Attachments:

Description

since zf2 b7 I am able to use expressions inside a db query (in my case for group_Concat).

whenever the query returns an empty result set, instead of getting an empty one i get a result of one row when all of it's column's value are null. if I remove the expression from the query this behavior does not happen.

I paste my code to : http://pastebin.com/dihQriaa

the bug can be easily overcome for now by checking if only one row returned and to check if a column that not supposed to get null value is null.

in my case: if ($resultSet->count()>0) { $rows=$resultSet->toArray(); if (count($rows) > 1 || $rows[0]['liquid_color_type_name'] != null ) { //overcome zf bug $result=json_encode($rows[0]); } }

thanks!

Comments

Posted by Ralph Schindler (ralph) on 2012-10-08T20:16:33.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2557

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts