8000 Add index mapping to column by jannes-io · Pull Request #11988 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add index mapping to column #11988

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

Merged
merged 1 commit into from
Jun 25, 2025
Merged

Add index mapping to column #11988

merged 1 commit into from
Jun 25, 2025

Conversation

jannes-io
Copy link

See #11982

@jannes-io jannes-io force-pushed the 3.4.x branch 2 times, most recently from c58579f to 507e0aa Compare June 14, 2025 14:46
@greg0ire
Copy link
Member

Please improve your commit message according to the contributing guide.

@greg0ire
Copy link
Member

This should target 3.5.x

@greg0ire greg0ire changed the base branch from 3.4.x to 3.5.x June 14, 2025 15:00
Copy link
Member
@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Please add documentation

@jannes-io jannes-io force-pushed the 3.4.x branch 4 times, most recently from 4479e7c to ad21cde Compare June 14, 2025 15:55
@jannes-io jannes-io requested a review from greg0ire June 14, 2025 15:55
@jannes-io
Copy link
Author

Added docs, changed test to introspect schema instead, and fixed a PHP8.1 issue.

greg0ire
greg0ire previously approved these changes Jun 15, 2025
SenseException
SenseException previously approved these changes Jun 15, 2025
beberlei
beberlei previously approved these changes Jun 17, 2025
Copy link
Member
@beberlei beberlei left a comment

Choose a reason for hiding this comment

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

Tentatively yes, but this needs more work. The test must be moved MappingDriverTestCase and adapted to all the drivers. The logic of converting the instruction to an index should be moved from AttributeDriver to ClassMetadata::mapField. Each driver only converts to the common array format for $field['index']

@jannes-io
Copy link
Author

Tentatively yes, but this needs more work. The test must be moved MappingDriverTestCase and adapted to all the drivers. The logic of converting the instruction to an index should be moved from AttributeDriver to ClassMetadata::mapField. Each driver only converts to the common array format for $field['index']

Since it's tentatively yes, and we've got 3/4 approvals, should I wait for this PR to be merged and then create a new one? Or do you want me to make changes in this PR?

@greg0ire
Copy link
Member

Personally, I think you should change this PR. doctrine/orm is an important project and design flaws can be hard to remove once published.

@jannes-io jannes-io dismissed stale reviews from beberlei, SenseException, and greg0ire via 25156e4 June 23, 2025 20:01
@jannes-io
Copy link
Author
jannes-io commented Jun 23, 2025

Personally, I think you should change this PR. doctrine/orm is an important project and design flaws can be hard to remove once published.

Done.

I opted to remove the ColumnIndex which we discussed in #11982. This is to simply remain consistent with the existing unique, and not having to invent new ways to extract this data from a simple XML attribute.

If users want to set their own index names, they should use the Index attribute or dedicated index xml.

Adds a new option to Column mapping to add indexes to class fields
directly instead of having to use the Index() class attribute.
This allows users to define indexes in traits
where access to the class isn't available.
Fixes doctrine#11982
@greg0ire greg0ire added this to the 3.5.0 milestone Jun 25, 2025
@greg0ire greg0ire merged commit a4b2035 into doctrine:3.5.x Jun 25, 2025
86 checks passed
@greg0ire
Copy link
Member

Thanks @jannes-io !

@jannes-io
Copy link
Author

Thanks for the quick replies and reviews @greg0ire . Glad we could get this feature added 🙂

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.

4 participants
0