1
0
mirror of synced 2025-01-18 06:21:40 +03:00
This commit is contained in:
zYne 2007-07-31 20:22:10 +00:00
parent 9e90fee1ed
commit a57226b086

View File

@ -34,13 +34,11 @@ class Doctrine_Query_Set extends Doctrine_Query_Part
{
public function parse($dql)
{
$parts = Doctrine_Tokenizer::sqlExplode($dql, ',');
preg_match_all("/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i", $dql, $m);
$result = array();
foreach ($parts as $part) {
$set = Doctrine_Tokenizer::sqlExplode($part, '=');
$e = explode('.', trim($set[0]));
if (isset($m[0])) {
foreach ($m[0] as $part) {
$e = explode('.', trim($part));
$field = array_pop($e);
$reference = implode('.', $e);
@ -48,10 +46,11 @@ class Doctrine_Query_Set extends Doctrine_Query_Part
$alias = $this->query->getTableAlias($reference);
$map = $this->query->getAliasDeclaration($reference);
$result[] = $map['table']->getColumnName($field) . ' = ' . $set[1];
}
return implode(', ', $result);
$dql = str_replace($part, $map['table']->getColumnName($field), $dql);
}
}
return $dql;
}
}