/** * Instanticate $this->oApi object * it will either contain empty values * in case this is new registration * or will have values from previous * application * * @return object $this */ protected function setApi() { $appid = $this->Request->get('app_id', 'i', null); $this->oApi = Clientdata::factory($this->Registry); if ($appid) { $a = $this->Registry->Mongo->API_CLIENTS->findOne(array('_id' => $appid, 'i_uid' => $this->Registry->Viewer->getUid())); if (!empty($a)) { $this->oApi->reload($a); } else { d('not found by id ' . $appid); } } return $this; }
/** * Instantiates $this->oApi object * it will either contain empty values * in case this is new registration * or will have values from previous * application * * @return object $this */ protected function setApi() { $appid = $this->Router->getSegment(1, 'i', 0); $this->oApi = Clientdata::factory($this->Registry); if (!empty($appid)) { $a = $this->Registry->Mongo->API_CLIENTS->findOne(array('_id' => $appid, 'i_uid' => $this->Registry->Viewer->getUid())); if (!empty($a)) { $this->oApi->reload($a); } else { d('APP not found by id ' . $appid . ' for viewer ' . $this->Registry->Viewer->getUid()); } } return $this; }