Skip to content

Commit

Permalink
use "_tm" as default alias for model-in-model table
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 9, 2022
1 parent bcd74c5 commit 39e7a3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Persistence/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function initQuery(Model $model): Query
if ($model->table) {
$query->table(
is_object($model->table) ? $model->table->action('select') : $model->table,
$model->table_alias ?? (is_object($model->table) ? '__inner__' : null)
$model->table_alias ?? (is_object($model->table) ? '_tm' : null)
);
}

Expand Down Expand Up @@ -639,7 +639,7 @@ public function getFieldSqlExpression(Field $field, Expression $expression): Exp
$prop = [
$field->hasJoin()
? ($field->getJoin()->foreign_alias ?: $field->getJoin()->short_name)
: ($field->getOwner()->table_alias ?: (is_object($field->getOwner()->table) ? '__inner__' : $field->getOwner()->table)),
: ($field->getOwner()->table_alias ?: (is_object($field->getOwner()->table) ? '_tm' : $field->getOwner()->table)),
$field->getPersistenceName(),
];
} else {
Expand Down

0 comments on commit 39e7a3f

Please sign in to comment.