Skip to content
Permalink
Browse files

Rename method to match 2.x method.

update() is a handy method that I don't want to use just yet.
  • Loading branch information...
markstory committed Jun 19, 2013
1 parent 10d97d8 commit 538840b23a92f385d5bc1cad98399f857a9c25bc
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/Cake/ORM/Table.php
  2. +4 −4 lib/Cake/Test/TestCase/ORM/TableTest.php
@@ -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
@@ -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)
@@ -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();
@@ -396,7 +396,7 @@ public function testUpdate() {
*
* @expectedException Cake\Database\Exception
*/
public function testUpdateFailure() {
public function testUpdateAllFailure() {
$table = $this->getMock(
'Cake\ORM\Table',
['_buildQuery'],
@@ -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.
You can’t perform that action at this time.