Saturday, 15 June 2013

php - Zend_Db_Select - Get all selected tables and columns -



php - Zend_Db_Select - Get all selected tables and columns -

we using zend framework in our company , we're using zend_db_select.

now building query (pre fetch) passed function. query built follows:

$select = $this->_selectall() ->setintegritycheck(false) ->joinleft('shop', $conshop, $colshop) ->joinleft('ptool', $conptool, $colptool) ->where('ptool.product_id > 0') ->where('ptool.product_is_from_shop = 0') ;

where $conshop , $colshop like:

$colshop = array('shop_id','shop_channel'); $conshop = "shop.shop_id = ptool.shop_id";

in new method want joined tables , columns going selected. $select gets passed method , this:

array ( ['shop'] => array ( [0] => 'shop_id', [1] => 'shop_channel', ... ), ['ptool'] => array ( [0] => 'shop_id', [1] => 'ptool_id', ... ), ... )

it nice if can pre fetch.

the background want sort shop_id illustration , table name used in 2 joined tables. if "order shop_id" i'd error column ambiguous. that's why need know columns belong table can "order shop.shop_id"

hope can help me. thanks! :)

php zend-framework zend-db zend-db-table

No comments:

Post a Comment