Quantcast

ZF2 - Zend\Db\Select join with Expression column fails?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ZF2 - Zend\Db\Select join with Expression column fails?

cmple
Hi,
When I'm trying to select-join-left using an expression as a column I get the following exception:

Warning: preg_split() expects parameter 2 to be string, object given in /***/vendor/ZF2/library/Zend/Db/Adapter/Platform/Mysql.php on line 92

$select = \Zend\Db\Sql\Select(array('c'=> 'file_category'));
$select->columns(array(
                        'category_id',
                        'title',
                        'added',
                        'modified'
));
$select->join(array('f' => 'file'), 'c.category_id = f.parent_id', array(
        //'file_id' // <-- this works!
        'count' => new Expression('COUNT(f.file_id)') // <-- this doesn't =(
       
), \Zend\Db\Sql\Select::JOIN_LEFT);

Am I missing something?

Thanks!
Roman.
Loading...