Skip to content

Commit

Permalink
Fixes #14211: Fixed regression in Unique and Exist validators
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed May 25, 2017
1 parent dbeadba commit 9b8b965
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/db/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ public function getTablesUsedInFrom()
.*?
(?:['"`\]]|}})
|
\w+
.*?
)
(?:
(?:
Expand All @@ -835,7 +835,7 @@ public function getTablesUsedInFrom()
.*?
(?:['"`\]]|}})
|
\w+
.*?
)
)?
\s*
Expand Down
15 changes: 15 additions & 0 deletions tests/framework/db/ActiveQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,19 @@ public function testGetTableAliasFromPrefixedTableName()
'{{%order_item}}' => '{{%order_item}}',
], $tables);
}

/**
* @see https://github.com/yiisoft/yii2/issues/14211
*/
public function testGetTableAliasFromTableNameWithDatabase()
{
$query = new ActiveQuery(null);
$query->from = 'tickets.workflows';

$tables = $query->getTablesUsedInFrom();

$this->assertEquals([
'{{tickets.workflows}}' => '{{tickets.workflows}}',
], $tables);
}
}

0 comments on commit 9b8b965

Please sign in to comment.