/**
* Constructor
*
* @throws \Scalr\Exception\AnalyticsException
*/
public function __construct()
{
$this->timelineEvent = new TimelineEventEntity();
$request = \Scalr::getContainer()->request;
$this->user = $request instanceof Scalr_UI_Request ? $request->getUser() : null;
$this->timelineEvent->userId = $this->user->id;
$constName = 'Scalr\\Stats\\CostAnalytics\\Entity\\TimelineEventEntity::EVENT_TYPE_' . strtoupper(substr(\Scalr::decamelize(preg_replace('/^.+\\\\([\\w]+)$/', '\\1', get_class($this))), 0, -6));
if (!defined($constName)) {
throw new AnalyticsException(sprintf("Constant '%s' is not defined.", $constName));
}
$this->timelineEvent->eventType = constant($constName);
}