static function saveCatLogCountry($countryId) { // Сохронякем индивидуальный лог по странам $check = CatLogToursCountry::findByAttributes(array("country_id" => $countryId, "date2" => date("Y-m")), 0); if (sizeof($check) > 0) { $check[0]->count++; $check[0]->save(); } else { $check = new CatLogToursCountry(); $check->count = 1; $check->country_id = $countryId; $check->date2 = date("Y-m"); if (!$check->save()) { print_r($check->getErrors()); } } }