From dd028bec3822d1d9c28c35d599d687e038c7705f Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 4 Jan 2007 11:23:26 +0000 Subject: Add chat demo and tutorial. --- framework/Data/ActiveRecord/TActiveRecord.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'framework/Data/ActiveRecord/TActiveRecord.php') diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 0855fabf..68d63a23 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -210,6 +210,28 @@ abstract class TActiveRecord extends TComponent return $gateway->deleteRecordsByPk($this,(array)$keys); } + + /** + * Delete multiple records using a criteria. + * @param string|TActiveRecordCriteria SQL condition or criteria object. + * @param mixed parameter values. + * @return int number of records deleted. + */ + public function deleteAll($criteria, $parameters=array()) + { + if(is_string($criteria)) + { + if(!is_array($parameters) && func_num_args() > 1) + { + $parameters = func_get_args(); + array_shift($parameters); + } + $criteria=new TActiveRecordCriteria($criteria,$parameters); + } + $gateway = $this->getRecordManager()->getRecordGateway(); + return $gateway->deleteRecordsByCriteria($this, $criteria); + } + /** * Populate the record with data, registers the object as clean. * @param string new record name -- cgit v1.2.3