Added a clear() function to Model.php (2.4 branch)

1.) Changed Pull Request from master branch to 2.4 (Old Pull Request: https://github.com/cakephp/cakephp/pull/1323)

2.) Updated return value in comment
This commit is contained in:
Pafu Inlu 2013-06-04 15:59:54 -06:00
parent f3c69c9f40
commit 089c9e1139

View file

@ -1497,6 +1497,17 @@ class Model extends Object implements CakeEventListener {
} }
return $this->data; return $this->data;
} }
/**
* This function is a convenient wrapper class to create(false) and, as the name suggests, clears the id, data, and validation errors.
*
* @return always boolean TRUE upon success
* @see Model::create()
*/
public function clear() {
$this->create(false);
return true;
}
/** /**
* Returns a list of fields from the database, and sets the current model * Returns a list of fields from the database, and sets the current model