Skip to content

Address quoteIdentifier() deprecation#11811

Merged
greg0ire merged 1 commit intodoctrine:3.3.xfrom
greg0ire:quoteIdentifier-depr
Jan 28, 2025
Merged

Address quoteIdentifier() deprecation#11811
greg0ire merged 1 commit intodoctrine:3.3.xfrom
greg0ire:quoteIdentifier-depr

Conversation

@greg0ire
Copy link
Copy Markdown
Member

@greg0ire greg0ire commented Jan 26, 2025

We should be using quoteSingleIdentifier(), assuming we only ever pass single identifiers here.

See doctrine/dbal#6590

We should be using quoteSingleIdentifier(), assuming we only ever pass
single identifiers here.

See doctrine/dbal#6590
@greg0ire greg0ire force-pushed the quoteIdentifier-depr branch from 5e5ee5d to aa141bf Compare January 26, 2025 11:01
Copy link
Copy Markdown
Member Author

@greg0ire greg0ire Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests pass, but I'm not sure if e.g. $tableName really is always going to be a single identifier here, and what to do if it isn't. That being said, if quoted is set, then… maybe we should treat everything as a single identifier?

Copy link
Copy Markdown
Member

@morozov morozov Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To preserve the existing behavior, table names should be split into schema name and unqualified name and quoted individually (basically, what quoteIdentifier() would do). Even if the identifier is quoted (e.g. "inventory.products"), AbstractAsset::_setName() in DBAL 4 would parse it and consider inventory to be the schema name.

I guess it's better to add or find an existing test that covers this case (e.g. create a schema in Postgres and and use a qualified table name on an entity).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After attempting what you suggested, I now believe that name will never contain the schema part, which means such a test cannot be written.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came to the opposite conclusion in #11812 (comment). But maybe we're talking about the same thing.

My understanding is that if the name contains a dot, the part before the dot will be considered the schema name.

In any event, quoting all values as "single identifier" looks right to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong, #12041 shows how to end up in such a situation. I should be able to write a test now.

@greg0ire greg0ire requested a review from morozov January 26, 2025 11:03
@greg0ire greg0ire changed the title Address quoteIdentifier() deprecations Address quoteIdentifier() deprecation Jan 26, 2025
@greg0ire greg0ire added this to the 3.3.2 milestone Jan 28, 2025
@greg0ire greg0ire merged commit aff82af into doctrine:3.3.x Jan 28, 2025
2 checks passed
@greg0ire greg0ire deleted the quoteIdentifier-depr branch July 29, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants