當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。