/**
  * Get mapped sql field
  *
  * @return string
  */
 public function getMappedSqlField()
 {
     if (!$this->isAttributeSetOrCategory()) {
         $mappedSqlField = $this->getEavAttributeTableAlias() . '.value';
     } elseif ($this->getAttribute() == 'category_ids') {
         $mappedSqlField = 'e.entity_id';
     } else {
         $mappedSqlField = parent::getMappedSqlField();
     }
     return $mappedSqlField;
 }
Esempio n. 2
0
 /**
  * Get field by attribute
  *
  * @return string
  */
 public function getMappedSqlField()
 {
     return $this->getAttribute() == 'category_ids' ? 'e.entity_id' : parent::getMappedSqlField();
 }
Esempio n. 3
0
 /**
  * @param AbstractCondition $condition
  * @param string $value
  * @return string
  * @throws \Magento\Framework\Exception
  */
 protected function _getMappedSqlCondition(AbstractCondition $condition, $value = '')
 {
     $argument = $condition->getMappedSqlField();
     if ($argument) {
         $conditionOperator = $condition->getOperatorForValidate();
         if (!isset($this->_conditionOperatorMap[$conditionOperator])) {
             throw new \Magento\Framework\Exception('Unknown condition operator');
         }
         $sql = str_replace(':field', $this->_connection->getIfNullSql($this->_connection->quoteIdentifier($argument), 0), $this->_conditionOperatorMap[$conditionOperator]);
         return $this->_expressionFactory->create(['expression' => $value . $this->_connection->quoteInto($sql, $condition->getBindArgumentValue())]);
     }
     return '';
 }