Created
October 14, 2014 11:07
-
-
Save aohorodnyk/a57fd85fe3990e8dd5f8 to your computer and use it in GitHub Desktop.
Это не валидно
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rangeBuilder->expects($this->any()) | |
->method('buildFilter') | |
->will( | |
$this->returnCallback( | |
function (FilterInterface $filter, $isNegation) use ( | |
$conditionManager | |
) { | |
/** | |
* @var \Magento\Framework\Search\Request\Filter\Range $filter | |
* @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter | |
*/ | |
$fromCondition = ''; | |
if (!is_null($filter->getFrom())) { | |
$fromCondition = $conditionManager->generateCondition( | |
$filter->getField(), | |
($isNegation ? '<' : '>='), | |
$filter->getFrom() | |
); | |
} | |
$toCondition = ''; | |
if (!is_null($filter->getTo())) { | |
$toCondition = $conditionManager->generateCondition( | |
$filter->getField(), | |
($isNegation ? '>=' : '<'), | |
$filter->getTo() | |
); | |
} | |
$unionOperator = $isNegation ? \Zend_Db_Select::SQL_OR : \Zend_Db_Select::SQL_AND; | |
return $conditionManager->combineQueries([$fromCondition, $toCondition], $unionOperator); | |
} | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment