Пример #1
0
 public static function addAllPreferences($userId, $preferencesIds)
 {
     $result = true;
     foreach ($preferencesIds as $preferenceId) {
         $hasNotification = UserPreferencesApi::hasNotification($userId, $preferenceId);
         if (!$hasNotification) {
             $userPreferences = new UserPreferences();
             $userPreferences->user_id = $userId;
             $userPreferences->preferences_id = $preferenceId;
             $result = $result && $userPreferences->save();
         }
     }
     return $result;
 }