Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update multiple columns with Doctrine in Symfony

I have to update multiple columns in Symfony, but I can nowhere find the solution... So, I'd like to do it in this way:

$q = Doctrine_Query::create()
     ->update('WebusersTable q')
     ->set('q.login_name','?','John')
     ->where('q.webuser_id=?',1)
     ->execute();

OK, that works, but I have to do it with several columns. I tried something like this, but it doesn't work:

$q = Doctrine_Query::create()
     ->update('WebusersTable q')
     ->set('q.login_name,q.name','?','kaka,pisa')
     ->where('q.webuser_id=?',1)
     ->execute();
like image 790
kungfucsiga Avatar asked Jan 26 '11 10:01

kungfucsiga


1 Answers

Try:

$q = Doctrine_Query::create()
     ->update('WebusersTable q')
     ->set('q.login_name', 'John')
     ->set('q.name', 'Another value')
     ->where('q.webuser_id=?',1)
     ->execute();
like image 148
Darmen Amanbayev Avatar answered Sep 22 '22 17:09

Darmen Amanbayev