Пример #1
0
 /**
  * Get argument value to bind
  *
  * @return array|float|int|mixed|string|\Zend_Db_Expr
  */
 public function getBindArgumentValue()
 {
     if ($this->getAttribute() == 'category_ids') {
         return new \Zend_Db_Expr($this->_productResource->getReadConnection()->select()->from($this->_productResource->getTable('catalog_category_product'), array('product_id'))->where('category_id IN (?)', $this->getValueParsed())->__toString());
     }
     return parent::getBindArgumentValue();
 }
Пример #2
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 '';
 }