Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address quoteIdentifier() deprecation #11811

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

greg0ire
Copy link
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
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
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
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
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.

@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
84 checks passed
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