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

[Documentation] Query Result Formats #11372

Merged
merged 3 commits into from Mar 23, 2024
Merged

Conversation

ThomasLandauer
Copy link
Contributor

@ThomasLandauer ThomasLandauer commented Mar 17, 2024

Page: https://www.doctrine-project.org/projects/doctrine-orm/en/2.19/reference/dql-doctrine-query-language.html#query-result-formats

Follow-up of #11359

The table I initially suggested is probably not working, since the text for each method is too long. And what I really wanted is to make it more scanable. So I tried boldfacing - if this doesn't work, I'll try something else.

Questions:

  1. This section here is basically the same as https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/dql-doctrine-query-language.html#hydration-modes ! So I'll try to merge them (in another PR), OK? I think the list is a better format (more scanable) - since those methods all work the same, there's no need for a full-blown code sample for each, IMO.

  2. getSingleColumnResult() is missing.

  3. For getSingleResult and getOneOrNullResult I couldn't find out the const

Page: https://www.doctrine-project.org/projects/doctrine-orm/en/2.19/reference/dql-doctrine-query-language.html#query-result-formats

Follow-up of doctrine#11359

The table I suggested is probably not working, since the text for each method is too long. And what I really wanted is to make it more *scanable*. So I tried boldfacing - if this doesn't work, I'll try something else.

Questions:

1. This section here is basically the same as https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/dql-doctrine-query-language.html#hydration-modes ! So I'll try to merge them (in another PR), OK? I think the list is a better format (more scanable) - since those methods all work the same, there's no need for a full-blown code sample for each, IMO.

2. `getSingleColumnResult()` is missing.
@greg0ire
Copy link
Member

greg0ire commented Mar 21, 2024

  1. About the merge, it sounds fair.
  2. That's… not a question, is it?
  3. That's not a question either, but I'll answer what I think was the implied question. getSingleResults and getOneOrNullResult both accept a $hydrationMode argument, and work will all consts.

it leads to more concise code.
In parentheses are the constants of the ``Query`` class which you can use with the
general-purpose method ``Query::execute(array $params = [], $hydrationMode = Query::HYDRATE_OBJECT)``.
In fact, the recommended methods in the list are just convenient shortcuts for the hydration mode.
Copy link
Member

Choose a reason for hiding this comment

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

This phrasing is a bit clumsy I think, it implies the list contains some methods that are recommended, and some methods that are not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, clumsy, indeed! I now deleted "recommended": Since using the method is shorter than using the constant, people will go for it anyway - so no need to explicitly recommend it :-)

@greg0ire greg0ire added this to the 2.19.4 milestone Mar 23, 2024
@greg0ire greg0ire merged commit e4a6c04 into doctrine:2.19.x Mar 23, 2024
1 check passed
@greg0ire
Copy link
Member

Thanks @ThomasLandauer !

@ThomasLandauer ThomasLandauer deleted the patch-12 branch March 23, 2024 10:40
ThomasLandauer added a commit to ThomasLandauer/orm that referenced this pull request Mar 26, 2024
Page: https://www.doctrine-project.org/projects/doctrine-orm/en/2.19/reference/dql-doctrine-query-language.html#query-result-formats

As announced in doctrine#11372 (comment), I merged the (mostly) identical sections.

* I changed the `const`s from `Query` to `AbstractQuery`
* I deleted this - mainly cause I didn't find a nice place for it:
    > In parentheses are the constants of the ``Query`` class which you can use with the
general-purpose method ``Query::execute(array $params = [], $hydrationMode = Query::HYDRATE_OBJECT)``.
ThomasLandauer added a commit to ThomasLandauer/orm that referenced this pull request Mar 27, 2024
Page: https://www.doctrine-project.org/projects/doctrine-orm/en/2.19/reference/dql-doctrine-query-language.html#query-result-formats

As announced in doctrine#11372 (comment), I merged the (mostly) identical sections.

* I changed the `const`s from `Query` to `AbstractQuery`
* I deleted this - mainly cause I didn't find a nice place for it:
    > In parentheses are the constants of the ``Query`` class which you can use with the
general-purpose method ``Query::execute(array $params = [], $hydrationMode = Query::HYDRATE_OBJECT)``.
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.

None yet

3 participants