Skip to content

Commit f86a36a

Browse files
committed
2 parents 2716b3a + dcfe6ec commit f86a36a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ActiveRecord.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,11 @@ public function addCondition(string $field, string $operator, $value, string $de
716716
$value = $this->filterParam($value);
717717
}
718718
$name = strtolower($name);
719+
720+
// skip adding the `table.` prefix if it's already there or a function is being supplied.
721+
$skip_table_prefix = (strpos($field, '.') !== false || strpos($field, '(') !== false);
719722
$expressions = new Expressions([
720-
'source' => ('where' === $name ? $this->table . '.' : '') . $field,
723+
'source' => ('where' === $name && $skip_table_prefix === false ? $this->table . '.' : '') . $field,
721724
'operator' => $operator,
722725
'target' => (
723726
is_array($value)

0 commit comments

Comments
 (0)