search by opted out and bool where redefinition in ORM
This commit is contained in:
@@ -88,7 +88,16 @@ class Email extends Base
|
||||
$fieldName .'IsOptedOut' => array(
|
||||
'type' => 'bool',
|
||||
'notStorable' => true,
|
||||
'select' => 'emailAddresses.opt_out'
|
||||
'select' => 'emailAddresses.opt_out',
|
||||
'where' => [
|
||||
'= TRUE' => [
|
||||
'sql' => 'emailAddresses.opt_out = true AND emailAddresses.opt_out IS NOT NULL'
|
||||
],
|
||||
'= FALSE' => [
|
||||
'sql' => 'emailAddresses.opt_out = false OR emailAddresses.opt_out IS NULL'
|
||||
]
|
||||
],
|
||||
'orderBy' => 'emailAddresses.opt_out {direction}'
|
||||
)
|
||||
),
|
||||
'relations' => array(
|
||||
|
||||
@@ -856,7 +856,33 @@ abstract class Base
|
||||
$fieldDefs = $entity->fields[$field];
|
||||
|
||||
$operatorModified = $operator;
|
||||
if (is_array($value)) {
|
||||
|
||||
$attributeType = null;
|
||||
if (!empty($fieldDefs['type'])) {
|
||||
$attributeType = $fieldDefs['type'];
|
||||
}
|
||||
|
||||
if (
|
||||
is_bool($value)
|
||||
&&
|
||||
in_array($operator, ['=', '<>'])
|
||||
&&
|
||||
$attributeType == IEntity::BOOL
|
||||
) {
|
||||
if ($value) {
|
||||
if ($operator === '=') {
|
||||
$operatorModified = '= TRUE';
|
||||
} else {
|
||||
$operatorModified = '= FALSE';
|
||||
}
|
||||
} else {
|
||||
if ($operator === '=') {
|
||||
$operatorModified = '= FALSE';
|
||||
} else {
|
||||
$operatorModified = '= TRUE';
|
||||
}
|
||||
}
|
||||
} else if (is_array($value)) {
|
||||
if ($operator == '=') {
|
||||
$operatorModified = 'IN';
|
||||
} else if ($operator == '<>') {
|
||||
|
||||
Reference in New Issue
Block a user