Skip to content

Commit

Permalink
optimize table name
Browse files Browse the repository at this point in the history
  • Loading branch information
cebe committed Mar 21, 2018
1 parent 0af1c05 commit b195d9e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions framework/db/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ protected static function filterCondition(array $condition)
$result = [];
// valid column names are table column names or column names prefixed with table name
$columnNames = static::getTableSchema()->getColumnNames();
$columnNames = array_merge($columnNames, array_map(function($columnName) {
return static::tableName() . ".$columnName";
$tableName = static::tableName();
$columnNames = array_merge($columnNames, array_map(function($columnName) use ($tableName) {
return "$tableName.$columnName";
}, $columnNames));
foreach ($condition as $key => $value) {
if (is_string($key) && !in_array($key, $columnNames, true)) {
Expand Down

0 comments on commit b195d9e

Please sign in to comment.