retrieve_by_string_fields(array("c_key" => $key)); if(empty($this->id)) return false; // need this to decrypt the key $this->check_date_relationships_load(); return $this; } /** * Fetch customer key by id * @param string $key * @return OAuthKey|false */ public static function fetchKey($key) { if(isset(self::$keys_cache[$key])) { return self::$keys_cache[$key]; } $k = new self(); if($k->getByKey($key)) { self::$keys_cache[$key] = $k; BeanFactory::registerBean("OAuthKeys", $k); return $k; } return false; } /** * Delete the key * also removed all tokens */ public function mark_deleted($id) { $this->db->query("DELETE from {$this->table_name} WHERE id='".$this->db->quote($id)."'"); $this->db->query("DELETE from oauth_tokens WHERE consumer='".$this->db->quote($id)."'"); } }