Esempio n. 1
0
 public function performAction()
 {
     $wakaPub = new WakaPub();
     foreach ($this->username as $username) {
         $user = new WakaUser();
         $user->userName = $username;
         if ($user->findSaved()) {
             $this->response->error("User {$username} already exists");
             continue;
         }
         $user = $wakaPub->getInfoByUsername($username);
         $user->save();
         $this->response->success("User id {$user->id} created for {$username}");
     }
 }
Esempio n. 2
0
 public function fetchStats()
 {
     $wakaPub = new WakaPub();
     $stats = $wakaPub->getStats($this->wakaId);
     $stats->userId = $this->id;
     if ($exists = $stats->findSaved()) {
         //$this->latestStatId = $exists->id;
         //$this->save();
         throw new Exception('Stats already exists', Exception::ALREADY_EXISTS);
     }
     $stats->save();
     $this->latestStatId = $stats->id;
     $this->save();
     foreach ($stats->details as $detail) {
         $detail->stat7id = $stats->id;
         $detail->typeId = StatType::getByText($detail->sectionText, $detail->typeText);
         $detail->save();
     }
 }