Skip to content

Instantly share code, notes, and snippets.

@stof
Created January 22, 2012 16:46
Show Gist options
  • Save stof/1657634 to your computer and use it in GitHub Desktop.
Save stof/1657634 to your computer and use it in GitHub Desktop.
DBAL params in the profiler
<?php
private function sanitizeQueries($queries)
{
foreach ($queries as $i => $query) {
foreach ((array) $query['params'] as $j => $param) {
if (isset($query['types'][$j])) {
$type = $query['types'][$j];
if (is_string($type)) {
$type = \Doctrine\DBAL\Types\Type::getType($type);
}
if ($type instanceof \Doctrine\DBAL\Types\Type) {
$queries[$i]['types'][$j] = $type->getBindingType();
$queries[$i]['params'][$j] = $type->convertToDatabaseValue($param, $this->registry->getConnection()->getDatabasePlatform());
}
}
}
}
return $queries;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment