-
Notifications
You must be signed in to change notification settings - Fork 833
Rewrite PDOStatement::fetch() docs #5022
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
base: master
Are you sure you want to change the base?
Conversation
Remove personalization Add constant tags Reorder fetch modes in a more logical way Update an example and make it runnable Remove useless wrapping <para> Use <simpara> when possible
| </simpara> | ||
| <caution> | ||
| <simpara> | ||
| The properties that will be populated are <emphasis>not</emphasis> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the column names or the values that were assigned before calling the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the values, but the column names are not passed either to the constructor AFAIK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, could you clarify this paragraph and say something along the lines that in either case no arguments are provided to the constructor?
Co-authored-by: Kamil Tekiela <[email protected]>
| If <constant>PDO::FETCH_CLASSTYPE</constant> is included, | ||
| the class to instantiate is determined by the value of the | ||
| first column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this exists in the current version too, but where else would the name of the class come from? This method doesn't have a parameter to provide the name of a class. IMHO it can only come from PDO::FETCH_CLASSTYPE. Am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this exists in the current version too, but where else would the name of the class come from? This method doesn't have a parameter to provide the name of a class. IMHO it can only come from
PDO::FETCH_CLASSTYPE. Am I wrong?
Yeah good point, I guess we should cross ref with PDOStatement::fetchObject()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I guess one could also call $sth->setFetchMode(PDO::FETCH_CLASS, 'Fruit'); but in that case why pass an argument to fetch()? Can this maybe be clarified? Maybe something like: "Unless the class name was specified in setFetchMode, this mode needs to be combined withPDO::FETCH_CLASSTYPE?
Remove personalization
Add constant tags
Reorder fetch modes in a more logical way
Update an example and make it runnable
Remove useless wrapping
<para>Use
<simpara>when possibleNow I do wonder if it makes sense to detail this all here or if we should refer back to https://www.php.net/manual/en/pdo.constants.fetch-modes.php instead?