| | 182 | public function set( $values, $con = null, $reinitCriteria = true ) |
|---|
| | 183 | { |
|---|
| | 184 | if ( !is_array($values) ) |
|---|
| | 185 | throw new Exception('{sfPropelFinder::set()} First argument is not an array'); |
|---|
| | 186 | |
|---|
| | 187 | $find = $this->getCriteria(); |
|---|
| | 188 | if ( count($find->getJoins()) ) |
|---|
| | 189 | throw new Exception('{sfPropelFinder::set()} Propel does not support multitable updates, please do not use join'); |
|---|
| | 190 | |
|---|
| | 191 | $set = new Criteria; |
|---|
| | 192 | foreach( $values as $columnName => $value ) |
|---|
| | 193 | { |
|---|
| | 194 | $set->add( $this->getColName($columnName), $value ); |
|---|
| | 195 | } |
|---|
| | 196 | |
|---|
| | 197 | if ( is_null($con) ) $con = Propel::getConnection(); |
|---|
| | 198 | |
|---|
| | 199 | $ret = BasePeer::doUpdate( $find, $set, $con ); |
|---|
| | 200 | $this->updateLatestQuery( $con ); // |
|---|
| | 201 | if($reinitCriteria) |
|---|
| | 202 | { |
|---|
| | 203 | $this->reinitCriteria(); |
|---|
| | 204 | } |
|---|
| | 205 | |
|---|
| | 206 | return $ret; |
|---|
| | 207 | } |
|---|
| | 208 | |
|---|
| | 209 | |
|---|