/**
  * Delete this registry value permanently.
  *
  * @throws Exception Throws if an error occurred.
  */
 public function delete()
 {
     // Prepare a query for the being deleted
     $statement = Database::getPDO()->prepare('DELETE FROM ' . Registry::getDatabaseTableName() . ' WHERE registry_id=:id');
     $statement->bindValue(':id', $this->getId(), PDO::PARAM_INT);
     // Execute the prepared query
     if (!$statement->execute()) {
         throw new Exception('Failed to query the database.');
     }
 }
 /**
  * Get a registry value by it's keys.
  *
  * @param string $key The key.
  *
  * @return RegistryValue|null The registry value as object, or null if no was found.
  *
  * @throws Exception Throws if an error occurred.
  */
 public static function getValue($key)
 {
     // Trim the key
     // TODO: Parse the registry key
     $key = trim($key);
     // Make sure a value exists for this registry with this key
     if (!static::isValueWithKey($key)) {
         return null;
     }
     // Prepare a query for the database to list registrys with this ID
     $statement = Database::getPDO()->prepare('SELECT registry_id FROM ' . Registry::getDatabaseTableName() . ' WHERE registry_key=:registry_key');
     $statement->bindValue(':registry_key', $key, PDO::PARAM_STR);
     // Execute the prepared query
     if (!$statement->execute()) {
         throw new Exception('Failed to query the database.');
     }
     // Return the as object
     return new RegistryValue($statement->fetch(PDO::FETCH_ASSOC)['registry_id']);
 }