Passed
Push — hans/its-the-same ( a633db )
by Simon
08:58
created

SearchSynonym::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Models;
5
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\TextareaField;
8
use SilverStripe\ORM\DataObject;
9
10
/**
11
 * Class \Firesphere\SolrSearch\Models\SearchSynonym
12
 *
13
 * @property string $Keyword
14
 * @property string $Synonym
15
 */
16
class SearchSynonym extends DataObject
17
{
18
    private static $table_name = 'SearchSynonym';
19
20
    private static $singular_name = 'Search synonym';
1 ignored issue
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
21
22
    private static $plural_name = 'Search synonyms';
1 ignored issue
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
23
24
    private static $db = [
25
        'Keyword' => 'Varchar(255)',
26
        'Synonym' => 'Text'
27
    ];
28
29
    private static $summary_fields = [
1 ignored issue
show
introduced by
The private property $summary_fields is not used, and could be removed.
Loading history...
30
        'Keyword',
31
        'Synonym'
32
    ];
33
34
    public function getCMSFields()
35
    {
36
        $fields = parent::getCMSFields();
37
38
        $fields->dataFieldByName('Synonym')->setDescription(_t(__CLASS__ . '.SYNONYM', 'Create synonyms for a given keyword, add as many synonyms comma separated.'));
39
40
        return $fields;
41
    }
42
43
    public function getCombinedSynonym()
44
    {
45
        return $this->Keyword . ',' . $this->Synonym;
46
    }
47
}
48