<?php
// Required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

// Include database and object files
include_once '../config/database.php';
include_once '../objects/createrole.php';

// Instantiate database
$database = new Database();
$db = $database->getConnection();

// Initialize object
$userrole = new UserRole($db);
$data = json_decode(file_get_contents("php://input"));
$userrole->id = $data->id;
$userrole->getOneRow();

// Convert object properties to an associative array
$userrole_arr = get_object_vars($userrole);

// Return the result as JSON
echo json_encode($userrole_arr);
?>
