From 089c9e11398ddcc439f80109f4197c8987523072 Mon Sep 17 00:00:00 2001 From: Pafu Inlu Date: Tue, 4 Jun 2013 15:59:54 -0600 Subject: [PATCH] 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 --- lib/Cake/Model/Model.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 8a1b5db40..b0f52a943 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1497,6 +1497,17 @@ class Model extends Object implements CakeEventListener { } 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