[*] MQ DB where fix

This commit is contained in:
rsgrinko committed 2022-07-06 19:24:23 +03:00
1 parent 3bf0e2e3d8
commit b8d69991f0
2 files changed
+4 -4

No files matched your search

+4 -3
View File
@@ -77,7 +77,7 @@
* *
* @return string * @return string
*/ */
public function createWhere($where, $logic = 'AND'): string public function createWhere($where, string $logic = 'AND'): string
{ {
if (!is_array($where)) { if (!is_array($where)) {
return $where; return $where;
@@ -99,9 +99,10 @@
} else { } else {
$symbol = '='; $symbol = '=';
} }
$where_string = $where_string . ' (' . $where_key . $symbol . '\'' . $where_item . '\') ' . $logic; $where_string = $where_string . ' ' . $where_key . $symbol . '\'' . $where_item . '\' ' . $logic;
} }
return substr($where_string, 0, -4); $offset = (strlen($logic) + 1);
return substr($where_string, 0, -$offset);
} }
/** /**
-1
View File
@@ -327,7 +327,6 @@
public function removeTask(?int $taskId = null): bool public function removeTask(?int $taskId = null): bool
{ {
if (empty($taskId)) { if (empty($taskId)) {
SystemFunctions::sendTelegram('Не передан идентификатор задания (' . $taskId . ')' . PHP_EOL . print_r(func_get_args(), true));
throw new CoreException('Не передан идентификатор задания'); throw new CoreException('Не передан идентификатор задания');
} }
return $this->DB->remove(self::TABLE, ['id' => $taskId]); return $this->DB->remove(self::TABLE, ['id' => $taskId]);