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;
}