当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Collection_Db::getResource方法代码示例

本文整理汇总了PHP中Varien_Data_Collection_Db::getResource方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection_Db::getResource方法的具体用法?PHP Varien_Data_Collection_Db::getResource怎么用?PHP Varien_Data_Collection_Db::getResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Collection_Db的用法示例。


在下文中一共展示了Varien_Data_Collection_Db::getResource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: applyLogToCollection

 /**
  * Add events log to a collection
  * The collection id field is used without corellation, so it must be unique.
  * DESC ordering by event will be added to the collection
  *
  * @param Varien_Data_Collection_Db $collection
  * @param int $eventTypeId
  * @param int $eventSubjectId
  * @param int $subtype
  * @param array $skipIds
  */
 public function applyLogToCollection(Varien_Data_Collection_Db $collection, $eventTypeId, $eventSubjectId, $subtype, $skipIds = array())
 {
     $idFieldName = $collection->getResource()->getIdFieldName();
     $derivedSelect = $this->getReadConnection()->select()->from($this->getTable('reports/event'), array('event_id' => new Zend_Db_Expr('MAX(event_id)'), 'object_id'))->where('event_type_id=?', (int) $eventTypeId)->where('subject_id=?', (int) $eventSubjectId)->where('subtype=?', (int) $subtype)->where('store_id IN(?)', $this->getCurrentStoreIds())->group('object_id');
     if ($skipIds) {
         if (!is_array($skipIds)) {
             $skipIds = array((int) $skipIds);
         }
         $derivedSelect->where('object_id NOT IN(?)', $skipIds);
     }
     $collection->getSelect()->joinInner(array('evt' => new Zend_Db_Expr("({$derivedSelect})")), "`{$idFieldName}`=evt.object_id", array())->order('evt.event_id DESC');
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:23,代码来源:Event.php

示例2: addGroupsCatalogFilterToCollection

 /**
  * Inner join the groupscatalog index table to hide entities not visible to the specified customer group id
  *
  * @param Varien_Data_Collection_Db $collection
  * @param int $groupId The customer group id
  * @return void
  */
 public function addGroupsCatalogFilterToCollection(Varien_Data_Collection_Db $collection, $groupId)
 {
     /* @var $helper Netzarbeiter_GroupsCatalog2_Helper_Data */
     $helper = Mage::helper('netzarbeiter_groupscatalog2');
     /**
      * This is slightly complicated but it works with products and
      * categories whether the flat tables enabled or not
      *
      * @var $entityType string
      * @var $entity Mage_Catalog_Model_Abstract
      */
     $entity = $collection->getNewEmptyItem();
     $entityType = $helper->getEntityTypeCodeFromEntity($entity);
     $this->_init($helper->getIndexTableByEntityType($entityType), 'id');
     if ($this->_doesIndexExists()) {
         $filterTable = $collection->getResource()->getTable($helper->getIndexTableByEntityType($entityType));
         $entityIdField = "{$this->_getCollectionTableAlias($collection)}.entity_id";
         $this->_addGroupsCatalogFilterToSelect($collection->getSelect(), $filterTable, $groupId, $collection->getStoreId(), $entityIdField);
     }
 }
开发者ID:aniljaiswal,项目名称:order-confirmation,代码行数:27,代码来源:Filter.php


注:本文中的Varien_Data_Collection_Db::getResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。