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

Add createNamedParameter to QueryBuilder #11528

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Conversation

norkunas
Copy link
Contributor

Closes #9878

Replaces #9883

Cherry picked tests from #9883

Fixed review suggestions

@stof
Copy link
Member

stof commented Jul 3, 2024

I don't think createPositionalParameter makes sense, as the index of the positional parameter depends on its position in the final query, which means that this API will very easily get broken. You cannot use positional parameters without caring about all of them.
If you don't want to care about the exact names of your parameters, there is no need to make them positional instead of making them named as dcValue<increment>

@norkunas
Copy link
Contributor Author

norkunas commented Jul 3, 2024

I don't think createPositionalParameter makes sense, as the index of the positional parameter depends on its position in the final query, which means that this API will very easily get broken. You cannot use positional parameters without caring about all of them.
If you don't want to care about the exact names of your parameters, there is no need to make them positional instead of making them named as dcValue<increment>

I care about only named parameters, so this one could be removed in my opinion

@greg0ire
Copy link
Member

greg0ire commented Jul 4, 2024

Sorry for originally suggesting adding it, I didn't see the flaw. Please remove it, and squash both commits together.

docs/en/reference/query-builder.rst Outdated Show resolved Hide resolved
src/QueryBuilder.php Show resolved Hide resolved
@norkunas norkunas changed the title Add createNamedParameter and createPositionalParameter to QueryBuilder Add createNamedParameter to QueryBuilder Jul 8, 2024
@norkunas
Copy link
Contributor Author

norkunas commented Jul 8, 2024

PR ready again for review

@greg0ire greg0ire added this to the 3.3.0 milestone Jul 11, 2024
@greg0ire greg0ire merged commit 1281707 into doctrine:3.3.x Jul 11, 2024
65 checks passed
@greg0ire
Copy link
Member

Thanks @norkunas !

@norkunas norkunas deleted the namedparams branch July 12, 2024 02:25
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