Skip to content

Commit

Permalink
[relations] Fix problematic polymorphic relation's generated relation…
Browse files Browse the repository at this point in the history
… IDs
  • Loading branch information
nirvn committed Jun 18, 2024
1 parent ba1d45e commit 62f615f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/qgspolymorphicrelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ QList<QgsRelation> QgsPolymorphicRelation::generateRelations() const
for ( const QString &referencedLayerId : referencedLayerIds )
{
QgsRelation relation;
QString referencedLayerName = d->mReferencedLayersMap[referencedLayerId]->name();
const QString referencedLayerName = d->mReferencedLayersMap[referencedLayerId]->name();

relation.setId( QStringLiteral( "%1_%2" ).arg( d->mRelationId, referencedLayerName ) );
relation.setId( QStringLiteral( "%1_%2" ).arg( d->mRelationId, referencedLayerId ) );
relation.setReferencedLayer( referencedLayerId );
relation.setReferencingLayer( d->mReferencingLayerId );
relation.setName( QStringLiteral( "Generated for \"%1\"" ).arg( referencedLayerName ) );
Expand All @@ -402,6 +402,11 @@ QList<QgsRelation> QgsPolymorphicRelation::generateRelations() const
continue;

relations << relation;

//TODO QGIS 4.0: remove these weak generated IDs (see https://github.com/qgis/QGIS/issues/47445)
relation.setId( QStringLiteral( "%1_%2" ).arg( d->mRelationId, referencedLayerName ) );
relation.setName( QStringLiteral( "Generated for \"%1\" (deprecated)" ).arg( referencedLayerName ) );
relations << relation;
}

return relations;
Expand Down

0 comments on commit 62f615f

Please sign in to comment.