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


PHP Mage_Core_Model_Resource_Db_Collection_Abstract::_beforeLoad方法代码示例

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


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

示例1: _beforeLoad

 /**
  * Prepare filters
  *
  * @return Mage_Paypal_Model_Resource_Payment_Transaction_Collection
  */
 protected function _beforeLoad()
 {
     parent::_beforeLoad();
     if ($this->isLoaded()) {
         return $this;
     }
     // filters
     if ($this->_createdBefore) {
         $this->getSelect()->where('main_table.created_at < ?', $this->_createdBefore);
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:17,代码来源:Collection.php

示例2: _beforeLoad

 /**
  * Before collection load
  *
  * @return Mage_Catalog_Model_Resource_Category_Flat_Collection
  */
 protected function _beforeLoad()
 {
     Mage::dispatchEvent($this->_eventPrefix . '_load_before', array($this->_eventObject => $this));
     return parent::_beforeLoad();
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:10,代码来源:Collection.php

示例3: _beforeLoad

 /**
  * Load collection data
  *
  * @return Mage_Core_Model_Resource_Store_Group_Collection
  */
 public function _beforeLoad()
 {
     if (!$this->getLoadDefault()) {
         $this->setWithoutDefaultFilter();
     }
     $this->addOrder('main_table.name', self::SORT_ORDER_ASC);
     return parent::_beforeLoad();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:13,代码来源:Collection.php

示例4: _beforeLoad

 /**
  * Add joins to select
  *
  * @return Mage_Eav_Model_Resource_Form_Attribute_Collection
  */
 protected function _beforeLoad()
 {
     $select = $this->getSelect();
     $connection = $this->getConnection();
     $entityType = $this->getEntityType();
     $this->setItemObjectClass($entityType->getAttributeModel());
     $eaColumns = array();
     $caColumns = array();
     $saColumns = array();
     $eaDescribe = $connection->describeTable($this->getTable('eav/attribute'));
     unset($eaDescribe['attribute_id']);
     foreach (array_keys($eaDescribe) as $columnName) {
         $eaColumns[$columnName] = $columnName;
     }
     $select->join(array('ea' => $this->getTable('eav/attribute')), 'main_table.attribute_id = ea.attribute_id', $eaColumns);
     // join additional attribute data table
     $additionalTable = $entityType->getAdditionalAttributeTable();
     if ($additionalTable) {
         $caDescribe = $connection->describeTable($this->getTable($additionalTable));
         unset($caDescribe['attribute_id']);
         foreach (array_keys($caDescribe) as $columnName) {
             $caColumns[$columnName] = $columnName;
         }
         $select->join(array('ca' => $this->getTable($additionalTable)), 'main_table.attribute_id = ca.attribute_id', $caColumns);
     }
     // add scope values
     if ($this->_getEavWebsiteTable()) {
         $saDescribe = $connection->describeTable($this->_getEavWebsiteTable());
         unset($saDescribe['attribute_id']);
         foreach (array_keys($saDescribe) as $columnName) {
             if ($columnName == 'website_id') {
                 $saColumns['scope_website_id'] = $columnName;
             } else {
                 if (isset($eaColumns[$columnName])) {
                     $code = sprintf('scope_%s', $columnName);
                     $expression = $connection->getCheckSql('sa.%s IS NULL', 'ea.%s', 'sa.%s');
                     $saColumns[$code] = new Zend_Db_Expr(sprintf($expression, $columnName, $columnName, $columnName));
                 } elseif (isset($caColumns[$columnName])) {
                     $code = sprintf('scope_%s', $columnName);
                     $expression = $connection->getCheckSql('sa.%s IS NULL', 'ca.%s', 'sa.%s');
                     $saColumns[$code] = new Zend_Db_Expr(sprintf($expression, $columnName, $columnName, $columnName));
                 }
             }
         }
         $store = $this->getStore();
         $joinWebsiteExpression = $connection->quoteInto('sa.attribute_id = main_table.attribute_id AND sa.website_id = ?', (int) $store->getWebsiteId());
         $select->joinLeft(array('sa' => $this->_getEavWebsiteTable()), $joinWebsiteExpression, $saColumns);
     }
     // add store attribute label
     if ($store->isAdmin()) {
         $select->columns(array('store_label' => 'ea.frontend_label'));
     } else {
         $storeLabelExpr = $connection->getCheckSql('al.value IS NULL', 'ea.frontend_label', 'al.value');
         $joinExpression = $connection->quoteInto('al.attribute_id = main_table.attribute_id AND al.store_id = ?', (int) $store->getId());
         $select->joinLeft(array('al' => $this->getTable('eav/attribute_label')), $joinExpression, array('store_label' => $storeLabelExpr));
     }
     // add entity type filter
     $select->where('ea.entity_type_id = ?', (int) $entityType->getId());
     return parent::_beforeLoad();
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:65,代码来源:Collection.php


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