TestManyManyThroughDataObject::getCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Bummzack\SortableFile\Tests\Model;
4
5
use Bummzack\SortableFile\Forms\SortableUploadField;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\ORM\DataObject;
9
use SilverStripe\Versioned\Versioned;
10
11
class TestManyManyThroughDataObject extends DataObject implements TestOnly
12
{
13
    private static $many_many = [
0 ignored issues
show
introduced by
The private property $many_many is not used, and could be removed.
Loading history...
14
        'Files' => [
15
            'through' => TestFileLinkDataObject::class,
16
            'from' => 'Owner',
17
            'to' => 'File',
18
        ]
19
    ];
20
21
    private static $owns = [
0 ignored issues
show
introduced by
The private property $owns is not used, and could be removed.
Loading history...
22
        'Files'
23
    ];
24
25
    private static $cascade_deletes = [
0 ignored issues
show
introduced by
The private property $cascade_deletes is not used, and could be removed.
Loading history...
26
        'Files'
27
    ];
28
29
    private static $extensions = [
0 ignored issues
show
introduced by
The private property $extensions is not used, and could be removed.
Loading history...
30
        Versioned::class
31
    ];
32
33
    private static $table_name = 'Bummzack_TestManyManyThroughDataObject';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
34
35
    public function getCMSFields()
36
    {
37
        return FieldList::create(
38
            SortableUploadField::create('Files')
39
        );
40
    }
41
42
    public function getLinkedFiles()
43
    {
44
        return $this->Files()->sort('SortOrder');
0 ignored issues
show
Bug introduced by
The method Files() does not exist on Bummzack\SortableFile\Te...nyManyThroughDataObject. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        return $this->/** @scrutinizer ignore-call */ Files()->sort('SortOrder');
Loading history...
45
    }
46
}
47