When I look in Chapter 8 of the book, I realize that Criteria seems to be mostly about building SELECT statements:
http://www.symfony-project.org/book/1_1/08-Inside-the-Model-Layer When I look to see how I should update a record, I find a lot of information about updating a particular record, which I already know how to do. But how do I update many records? I want this SQL: UPDATE player SET mufson_award_winner='' WHERE new_team_id='712' How do I get that? Right now, this is the code I have. I can not figure out how to replace the "magic" part. // 03-20-09 - normally, one player per team wins the Mufson award. Sometimes, when there // are syblings on a team, they will give the award to both syblings. Here we are getting // an array of ids of the players who've won the Mufson Award. We must update the // mufson_award_winner field in the player database table $arrayWhoWonTheMufsonAward = $request->getParameter ('whoWonTheMufsonAward'); if (isset($arrayWhoWonTheMufsonAward)) { if (is_array($arrayWhoWonTheMufsonAward)) { // First, we must ensure that none of the players are marked as winners of the // the Mufson award. We will blank anyone currently chosen as a winner. Then // we will assign the winner. $c = new Criteria(); $c->add(NewPlayerPeer::NEW_TEAM_ID, $request->getParameter ('id')); [now something magic happens and all the players on the team have their mufson_award_winner field blanked] for ($i=0; $i < count($arrayWhoWonTheMufsonAward); $i++) { $playerId = $arrayWhoWonTheMufsonAward[$i]; $playerModelClass = new NewPlayer(); $playerModelClass->setNew(false); $playerModelClass->setId($playerId); $playerModelClass->setMufsonAwardWinner("1"); $playerModelClass->save(); } } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---