public function deleteVariableAction($farmRoleId, $name)
{
$farmRole = $this->getFarmRole($farmRoleId, null, true);
$fetch = $this->getGlobalVariable($name, $this->getVariableInstance(), $farmRole->roleId, $farmRole->farmId, $farmRoleId);
$variable = GlobalVariable\FarmRoleGlobalVariable::findPk($farmRoleId, $name);
if (empty($fetch)) {
throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Global Variable does not exist.");
}
if (empty($variable)) {
throw new ApiErrorException(403, ErrorMessage::ERR_SCOPE_VIOLATION, "You can only delete Global Variables declared in Farm Role scope.");
}
$variable->delete();
return $this->result(null);
}