Passed
Pull Request — master (#47)
by
unknown
02:01
created

RegistryPageTestContactExtra::getStaticReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace SilverStripe\Registry\Tests\Stub;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\TextField;
8
use SilverStripe\ORM\DataObject;
9
use Silverstripe\Control\Controller;
10
use SilverStripe\Registry\RegistryDataInterface;
11
use SilverStripe\Registry\Tests\Stub\RegistryPageTestPage;
12
13
class RegistryPageTestContactExtra extends DataObject implements RegistryDataInterface, TestOnly
14
{
15
    private static $table_name = 'RegistryPageTestContactExtra';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
16
17
    private static $use_link = true;
0 ignored issues
show
introduced by
The private property $use_link is not used, and could be removed.
Loading history...
18
19
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
20
        'FirstName' => 'Varchar(50)',
21
        'Surname' => 'Varchar(50)',
22
    ];
23
24
    private static $has_one = [
0 ignored issues
show
introduced by
The private property $has_one is not used, and could be removed.
Loading history...
25
        'RegistryPage' => RegistryPageTestPage::class
26
    ];
27
28
    private static $summary_fields = [
0 ignored issues
show
introduced by
The private property $summary_fields is not used, and could be removed.
Loading history...
29
        'FirstName' => 'First name',
30
        'Surname' => 'Surname',
31
        'RegistryPage.Title' => 'Registry Page',
32
        'StaticReference' => 'Other'
33
    ];
34
35
    private static $searchable_fields = [
0 ignored issues
show
introduced by
The private property $searchable_fields is not used, and could be removed.
Loading history...
36
        'FirstName',
37
        'Surname',
38
        'RegistryPage.Title'
39
    ];
40
41
    public function getSearchFields()
42
    {
43
        return new FieldList(
44
            new TextField('FirstName', 'First name'),
45
            new TextField('Surname', 'Surname'),
46
            new TextField('RegistryPage.Title', 'Registry Page')
47
        );
48
    }
49
50
    public function getStaticReference()
51
    {
52
        return 'Static Reference';
53
    }
54
55
    public function Link($action = null)
56
    {
57
        $page = RegistryPageTestPage::get()->filter('DataClass', RegistryPageTestContactExtra::class)->First();
58
        return Controller::join_links($page->Link(), $action, $this->ID);
59
    }
60
}
61