Jira issue originally created by user jmontoya:
In the documentation of the the ResultStatement::fetch() function says that we should use the Query::HYDRATE_* constants but that constant does not exist at least not in 2.3.4.
Should I just use PDO::FETCH_BOTH? But if I change the driver to sqlite or whatever is it going to work well?
Comment created by @ocramius:
Query constants are defined in AbstractQuery (superclass of the Query class) - see https://github.com/doctrine/doctrine2/blob/2.3.4/lib/Doctrine/ORM/AbstractQuery.php#L45-L60
Comment created by jmontoya:
Hello Marco! Thanks for your fast answer!
Some comments: The constant HYDRATE_BOTH doesn't exist, at least not with that name. Documentation should be updated too.
Another thing I'm obliged to use ORM to call a constant in DBAL? Not a problem for me because I need both :)
Sorry, confused this one as an ORM issue.
Checked briefly - you should indeed use the PDO::FETCH_* constants.
Can you link the document that contains the imprecision?
This is the documentation in the fetch(), fetchAll() functions in DBAL:
For example, if I want to fetch an Object what should I use 1. or 2. ? I don't know if this have some implications in other drivers.
An update to the documentation will be fine too:
it should be:
with a list of options (constants) ...
Working in a PR but first we need to define those constants ...
Comment created by @deeky666:
I guess this is a Doctrine 1 legacy problem. I was confused by the methods' documentation today, too. I think the documentation was copied from Doctrine 1 code and never updated. You should definitely use PDO_FETCH* constants for this as the drivers rely on this. I will PR a documentation update these days...
Documentation fixed in commit: 7fc6b42
Issue was closed with resolution "Fixed"