Rewrite PDOStatement::fetch() docs - #5022
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.
Do you mean the column names or the values that were assigned before calling the constructor?
There was a problem hiding this comment.
I mean the values, but the column names are not passed either to the constructor AFAIK?
There was a problem hiding this comment.
Ok, could you clarify this paragraph and say something along the lines that in either case no arguments are provided to the constructor?
| 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.
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.
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.
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?