/** * Get token record by ID */ private function _getTokenRecordById($id = null) { if ($id) { $record = Oauth_TokenRecord::model()->findById($id); if (!$record) { throw new Exception(Craft::t('No oauth token exists with the ID “{id}”', array('id' => $id))); } } else { $record = new Oauth_TokenRecord(); } return $record; }
private function _getTokenRecordByNamespace($handle, $namespace) { Craft::log(__METHOD__, LogLevel::Info, true); $conditions = 'provider=:provider AND namespace=:namespace'; $params = array(':provider' => $handle, ':namespace' => $namespace); $tokenRecord = Oauth_TokenRecord::model()->find($conditions, $params); return $tokenRecord; }