本文整理汇总了PHP中Magento\Framework\DB\Select::group方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::group方法的具体用法?PHP Select::group怎么用?PHP Select::group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DB\Select
的用法示例。
在下文中一共展示了Select::group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modifySelect
/**
* Add JOINs to original select.
*
* @param \Magento\Framework\DB\Select $select
* @return \Magento\Framework\DB\Select
*/
public function modifySelect(\Magento\Framework\DB\Select $select)
{
/* aliases for tables ... */
$tblEntity = 'e';
// this is alias for 'catalog_product_entity' table
$tblStockItem = $this->_resource->getTableName(self::TBL_STOCK_ITEM);
$tblWrhsQty = $this->_resource->getTableName(self::TBL_WRHS_QTY);
/* ... and fields */
$fldStockItemProdId = StockItem::PRODUCT_ID;
$fldStockItemId = StockItem::ITEM_ID;
$fldEntityId = \Magento\Eav\Model\Entity::DEFAULT_ENTITY_ID_FIELD;
$fldQty = self::FLD_QTY;
$fldStockItemRef = Quantity::ATTR_STOCK_ITEM_REF;
/* LEFT JOIN `cataloginventory_stock_item` */
$on = "`{$tblStockItem}`.`{$fldStockItemProdId}`=`{$tblEntity}`.`{$fldEntityId}`";
$fields = [];
$select->joinLeft($tblStockItem, $on, $fields);
/* LEFT JOIN `prxgt_wrhs_qty` */
$on = "`{$tblWrhsQty}`.`{$fldStockItemRef}`=`{$tblStockItem}`.`{$fldStockItemId}`";
$fields = [$fldQty => $this->getEquationQty()];
$select->joinLeft($tblWrhsQty, $on, $fields);
/* GROUP BY */
$select->group("{$tblEntity}.{$fldEntityId}");
return $select;
}