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


PHP AbstractCollection::addFieldToFilter方法代码示例

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


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

示例1: addFieldToFilter

 /**
  * Add field filter to collection
  *
  * @param string|array $field
  * @param null|string|array $condition
  * @return $this
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if ($field === 'store_id') {
         return $this->addStoreFilter($condition, false);
     }
     return parent::addFieldToFilter($field, $condition);
 }
开发者ID:samitrimal,项目名称:Blog-Extension-for-Magento-2,代码行数:14,代码来源:Collection.php

示例2: addFieldToFilter

 /**
  * @inheritdoc
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if (in_array($field, ['created_at', 'updated_at'], true)) {
         $field = 'main_table.' . $field;
     }
     return parent::addFieldToFilter($field, $condition);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Collection.php

示例3: addFieldToFilter

 /**
  * Multi store view.
  *
  * @param string|array      $field
  * @param null|string|array $condition
  */
 public function addFieldToFilter($field, $condition = null)
 {
     $attributes = array('name', 'status', 'click_url', 'target', 'image_alt', 'maintable');
     $storeViewId = $this->getStoreViewId();
     if (in_array($field, $attributes) && $storeViewId) {
         if (!in_array($field, $this->_addedTable)) {
             $sql = sprintf('main_table.banner_id = %s.banner_id AND %s.store_id = %s  AND %s.attribute_code = %s ', $this->getConnection()->quoteTableAs($field), $this->getConnection()->quoteTableAs($field), $this->getConnection()->quote($storeViewId), $this->getConnection()->quoteTableAs($field), $this->getConnection()->quote($field));
             $this->getSelect()->joinLeft(array($field => $this->getTable('magestore_bannerslider_value')), $sql, array());
             $this->_addedTable[] = $field;
         }
         $fieldNullCondition = $this->_translateCondition("{$field}.value", ['null' => TRUE]);
         $mainfieldCondition = $this->_translateCondition("main_table.{$field}", $condition);
         $fieldCondition = $this->_translateCondition("{$field}.value", $condition);
         $condition = $this->_implodeCondition($this->_implodeCondition($fieldNullCondition, $mainfieldCondition, \Zend_Db_Select::SQL_AND), $fieldCondition, \Zend_Db_Select::SQL_OR);
         $this->_select->where($condition, NULL, \Magento\Framework\DB\Select::TYPE_CONDITION);
         return $this;
     }
     if ($field == 'store_id') {
         $field = 'main_table.banner_id';
     }
     return parent::addFieldToFilter($field, $condition);
 }
开发者ID:JakeSharp,项目名称:Bannerslider-Magento2,代码行数:28,代码来源:Collection.php

示例4: addFieldToFilter

 /**
  * Provide support for website id filter
  *
  * @param string $field
  * @param null|string|array $condition
  * @return $this
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if ($field == 'website_ids') {
         return $this->addWebsiteFilter($condition);
     }
     parent::addFieldToFilter($field, $condition);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AbstractCollection.php

示例5: addFieldToFilter

 /**
  * Checks if field is 'subscribers_total', 'subscribers_sent'
  * to add specific filter or adds reguler filter
  *
  * @param string $field
  * @param null|string|array $condition
  * @return $this
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if (in_array($field, ['subscribers_total', 'subscribers_sent'])) {
         $this->addFieldToFilter('main_table.queue_id', ['in' => $this->_getIdsFromLink($field, $condition)]);
         return $this;
     } else {
         return parent::addFieldToFilter($field, $condition);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Collection.php


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