summaryrefslogtreecommitdiffstats
path: root/library/Director/Db/Branch/MergeError.php
blob: 45c7b5e0011bb74dc05a405e90db6fbb079daa93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace Icinga\Module\Director\Db\Branch;

use Exception;
use gipfl\Translation\TranslationHelper;

abstract class MergeError extends Exception
{
    use TranslationHelper;

    /** @var BranchActivity */
    protected $activity;

    public function __construct(BranchActivity $activity)
    {
        $this->activity = $activity;
        parent::__construct($this->prepareMessage());
    }

    abstract protected function prepareMessage();

    public function getObjectTypeName()
    {
        return preg_replace('/^icinga_/', '', $this->getActivity()->getObjectTable());
    }

    public function getNiceObjectName()
    {
        return $this->activity->getObjectName();
    }

    public function getActivity()
    {
        return $this->activity;
    }
}