Skip to content

Commit

Permalink
Rename method to match 2.x method.
Browse files Browse the repository at this point in the history
update() is a handy method that I don't want to use just yet.
  • Loading branch information
markstory committed Jun 20, 2013
1 parent 10d97d8 commit 538840b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/ORM/Table.php
Expand Up @@ -487,7 +487,7 @@ protected function _buildQuery() {
}

/**
* Update one or many rows.
* Update all matching rows.
*
* Sets the $fields to the provided values based on $conditions.
* This method will *not* trigger beforeSave/afterSave events. If you need those
Expand All @@ -497,7 +497,7 @@ protected function _buildQuery() {
* @param array $conditions An array of conditions, similar to those used with find()
* @return boolean Success
*/
public function update($fields, $conditions) {
public function updateAll($fields, $conditions) {
$query = $this->_buildQuery();
$query->update($this->table())
->set($fields)
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Test/TestCase/ORM/TableTest.php
Expand Up @@ -379,10 +379,10 @@ public function testBelongsToMany() {
*
* @return void
*/
public function testUpdate() {
public function testUpdateAll() {
$table = new Table(['table' => 'users', 'connection' => $this->connection]);
$fields = ['user' => 'mark'];
$result = $table->update($fields, ['id <' => 4]);
$result = $table->updateAll($fields, ['id <' => 4]);
$this->assertTrue($result);

$result = $table->find('all')->select(['user'])->toArray();
Expand All @@ -396,7 +396,7 @@ public function testUpdate() {
*
* @expectedException Cake\Database\Exception
*/
public function testUpdateFailure() {
public function testUpdateAllFailure() {
$table = $this->getMock(
'Cake\ORM\Table',
['_buildQuery'],
Expand All @@ -409,7 +409,7 @@ public function testUpdateFailure() {
$query->expects($this->once())
->method('execute')
->will($this->throwException(new \Cake\Database\Exception('Not good')));
$table->update(['user' => 'mark'], []);
$table->updateAll(['user' => 'mark'], []);
}

}

0 comments on commit 538840b

Please sign in to comment.