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


PHP AbstractCollection::addFieldToFilter方法代码示例

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


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

示例1: addFieldToFilter

 /**
  * Add field filter to collection
  * If $attribute is an array will add OR condition with following format:
  * array(
  *     array('attribute'=>'firstname', 'like'=>'test%'),
  *     array('attribute'=>'lastname', 'like'=>'test%'),
  * )
  *
  * @param string $field
  * @param null|string|array $condition
  * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
  *
  * @see self::_getConditionSql for $condition
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if (isset($this->_fields[$field])) {
         $field = $this->_fields[$field];
     }
     return parent::addFieldToFilter($field, $condition);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:21,代码来源:Collection.php

示例2: 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:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:Collection.php

示例3: 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:aiesh,项目名称:magento2,代码行数:15,代码来源:AbstractCollection.php

示例4: addFieldToFilter

 /**
  * Add field filter to collection
  *
  * @param string $field
  * @param null|string|array $condition
  * @return $this
  * @see self::_getConditionSql for $condition
  */
 public function addFieldToFilter($field, $condition = null)
 {
     if ($field == 'name') {
         $conditionSql = $this->_getConditionSql($this->getConnection()->getIfNullSql('p.value', 'p_d.value'), $condition);
         $this->getSelect()->where($conditionSql, null, \Magento\Framework\DB\Select::TYPE_CONDITION);
         return $this;
     } else {
         return parent::addFieldToFilter($field, $condition);
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:Collection.php

示例5: addFieldToFilter

 /**
  * Filter by customer ID, as 'type' field does not exist
  *
  * @param string $fieldName
  * @param array $condition
  * @return $this
  */
 public function addFieldToFilter($fieldName, $condition = null)
 {
     if ($fieldName == 'type' && is_array($condition) && isset($condition['eq'])) {
         $fieldName = 'customer_id';
         if ($condition['eq'] === \Magento\Customer\Model\Visitor::VISITOR_TYPE_VISITOR) {
             $condition = ['null' => 1];
         } else {
             $condition = ['moreq' => 1];
         }
     }
     return parent::addFieldToFilter($this->_getFieldMap($fieldName), $condition);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Collection.php

示例6: addFieldToFilter

 /**
  * @param string|array $field
  * @param string|int|array|null $condition
  * @return \Magento\Cms\Model\Resource\Block\Collection
  */
 public function addFieldToFilter($field, $condition = null)
 {
     return parent::addFieldToFilter($field, $condition);
 }
开发者ID:pradeeprcs,项目名称:TestModule,代码行数:9,代码来源:Collection.php


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