Completed
Pull Request — master (#53)
by Roman
03:04
created

TestManyManyThroughDataObject::getLinkedFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
    public function getCMSFields()
34
    {
35
        return FieldList::create(
36
            SortableUploadField::create('Files')
37
        );
38
    }
39
40
    public function getLinkedFiles()
41
    {
42
        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

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