diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 6940956b05..81c01bcd66 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -822,7 +822,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface .*? (?:['"`\]]|}}) | - \w+ + .*? ) (?: (?: @@ -835,7 +835,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface .*? (?:['"`\]]|}}) | - \w+ + .*? ) )? \s* diff --git a/tests/framework/db/ActiveQueryTest.php b/tests/framework/db/ActiveQueryTest.php index f8e4b0747b..792f896439 100644 --- a/tests/framework/db/ActiveQueryTest.php +++ b/tests/framework/db/ActiveQueryTest.php @@ -357,4 +357,19 @@ abstract class ActiveQueryTest extends DatabaseTestCase '{{%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); + } }