public function __construct($objId = null, $action = null, $NotificationId = null, $autoSave = true)
{
# We call super, because there are some essential steps that need to be performed
# before we start (also this is used when retrieving an existing Object from DB)
parent::__construct($NotificationId);
# If we want to create a new Notification
if ($objId) {
$this->Controller = "notes";
$this->CreatorUserId = HTTPSession::getInstance()->GetUserID();
$this->ObjectId = $objId;
$this->ObjectType = "Note";
$this->ProjectId = HTTPSession::getInstance()->PROJECT_ID;
$this->Action = $action;
# We have just set the values above, however unless we use set methods, DataBoundObject
# won't recognize these as modified, therefore we have to add them to modified relations table
$this->arModifiedRelations['Controller'] = "1";
$this->arModifiedRelations['CreatorUserId'] = "1";
$this->arModifiedRelations['ObjectId'] = "1";
$this->arModifiedRelations['ObjectType'] = "1";
$this->arModifiedRelations['ProjectId'] = "1";
$this->arModifiedRelations['Action'] = "1";
# Save the notification
if ($autoSave) {
$this->Save();
}
}
}