Skip to content

Commit b195d9e

Browse files
committed
optimize table name
1 parent 0af1c05 commit b195d9e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

framework/db/ActiveRecord.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ protected static function filterCondition(array $condition)
209209
$result = [];
210210
// valid column names are table column names or column names prefixed with table name
211211
$columnNames = static::getTableSchema()->getColumnNames();
212-
$columnNames = array_merge($columnNames, array_map(function($columnName) {
213-
return static::tableName() . ".$columnName";
212+
$tableName = static::tableName();
213+
$columnNames = array_merge($columnNames, array_map(function($columnName) use ($tableName) {
214+
return "$tableName.$columnName";
214215
}, $columnNames));
215216
foreach ($condition as $key => $value) {
216217
if (is_string($key) && !in_array($key, $columnNames, true)) {

0 commit comments

Comments
 (0)