public function deleteVariableAction($farmId, $name)
{
$this->getFarm($farmId, Acl::PERM_FARMS_UPDATE);
$fetch = $this->getGlobalVariable($name, $this->getVariableInstance(), 0, $farmId);
$variable = GlobalVariable\FarmGlobalVariable::findPk($farmId, $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 scope.");
}
$variable->delete();
return $this->result(null);
}