fix
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Ixrs\Catalog\Support;
|
||||
|
||||
class IBlock
|
||||
{
|
||||
static array $operations = [
|
||||
'!><' => 'NB', //not between
|
||||
'!=' => 'NI', //not Identical
|
||||
'!%' => 'NS', //not substring
|
||||
'><' => 'B', //between
|
||||
'>=' => 'GE', //greater or equal
|
||||
'<=' => 'LE', //less or equal
|
||||
'=' => 'I', //Identical
|
||||
'%' => 'S', //substring
|
||||
'?' => '?', //logical
|
||||
'>' => 'G', //greater
|
||||
'<' => 'L', //less
|
||||
'!' => 'N', // not field LIKE val
|
||||
'*' => 'FT', // partial full text match
|
||||
'*=' => 'FTI', // identical full text match
|
||||
'*%' => 'FTL', // partial full text match based on LIKE
|
||||
];
|
||||
|
||||
public static function getOperationFilter($key)
|
||||
{
|
||||
$re = '/^(!><|!=|!%|><|>=|<=|=|%|\?|>|<|!|\*|\*=|\*%)?(PROPERTY_)(\d+)$/m';
|
||||
|
||||
$matches = [];
|
||||
$r = preg_match($re, $key, $matches);
|
||||
|
||||
if($r){
|
||||
return [
|
||||
'FIELD' => mb_strtoupper($matches[2] . $matches[3]),
|
||||
'OPERATION' => static::$operations[$matches[1]]??'',
|
||||
'PREFIX' => $matches[1],
|
||||
'ID' => $matches[3],
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user