Scalr\Stats\CostAnalytics\Events\AbstractEvent::fire PHP Method

fire() public method

Fires an event
public fire ( ) : boolean
return boolean Returns true if a new record has been added
    public function fire()
    {
        $this->timelineEvent->uuid = $this->timelineEvent->type('uuid')->toPhp(substr(hash('sha1', $this->messageToHash, true), 0, 16));
        if (!$this->timelineEvent->findPk($this->timelineEvent->uuid)) {
            $this->timelineEvent->description = $this->message;
            $this->timelineEvent->save();
            //Creates timeline event records for events which affect cost centers
            foreach (array_filter($this->ccs, [$this, 'callbackFilter']) as $ccId) {
                $entity = new TimelineEventCostCentreEntity($this->timelineEvent->uuid, $ccId);
                $entity->save();
            }
            //Creates timeline event records for events which affect projects
            foreach (array_filter($this->projects, [$this, 'callbackFilter']) as $projectId) {
                $entity = new TimelineEventProjectEntity($this->timelineEvent->uuid, $projectId);
                $entity->save();
            }
            return true;
        }
        return false;
    }