php - Retrieving boolean values with Doctrine's DBAL in Symfony -
i'm using dbal in symfony project access data in mysql database. when querying tables boolean fields (created tinyint) tinyint values in php booleans.
somehow, i'd same mapping using doctrine directly.
i thought mapping conversion (from mysql php) implemented in dbal, i'm not sure if it's suppose work way (this layer mapping values back).
i have tried registering custom mapping following one, no success:
$this->conn->getdatabaseplatform()->registerdoctrinetypemapping('tinyint', 'boolean'); $sql = " select se.survey_id, se.anonymous survey_edition se "; $stmt = $this->conn->prepare($sql); $stmt->execute(); $result = $stmt->fetch();
in case 'anonymous' tinyint(1) field in mysql, $result['anonymous'] boolean instead of integer.
do know if possible boolean values in php mysql query through doctrine's dbal?
thanks.
without using orm
cannot (as far know it) define model types.
way resolve iterate on data , cast boolean values such as:
$item[$i]['foobar'] = (bool)$item[$i]['foobar']
but not close ideal solution.
Comments
Post a Comment