public function reset($entryId) { // get record from the database $entryCountRecord = EntryCountRecord::model()->findByAttributes(array('entryId' => $entryId)); // if the record exists, delete it from the database if ($entryCountRecord) { $entryCountRecord->delete(); } }
/** * Reset count * * @param int $entryId */ public function reset($entryId) { // get record from DB $entryCountRecord = EntryCountRecord::model()->findByAttributes(array('entryId' => $entryId)); // if record exists then delete if ($entryCountRecord) { // delete record from DB $entryCountRecord->delete(); } // log reset EntryCountPlugin::log('Entry count with entry ID ' . $entryId . ' reset by ' . craft()->userSession->getUser()->username, LogLevel::Info, true); // fire an onResetCount event $this->onResetCount(new Event($this, array('entryId' => $entryId))); }