function Save()
{
$row = $this->Unbind();
unset($row['id']);
// Prepare SQL statement
$set = array();
$bind = array();
foreach ($row as $field => $value) {
$set[] = "`{$field}` = ?";
$bind[] = $value;
}
$set = join(', ', $set);
try {
// Perform Update
$bind[] = $this->ID;
$this->DB->Execute("UPDATE farm_roles SET {$set} WHERE id = ?", $bind);
} catch (Exception $e) {
throw new Exception("Cannot save farm role. Error: " . $e->getMessage(), $e->getCode());
}
if (!empty($this->ID) && !empty($this->FarmID) && \Scalr::getContainer()->analytics->enabled) {
\Scalr::getContainer()->analytics->tags->syncValue($this->GetFarmObject()->ClientID, \Scalr\Stats\CostAnalytics\Entity\TagEntity::TAG_ID_FARM_ROLE, $this->ID, sprintf('%s', $this->Alias));
}
}