Passed
Push — master ( 6acaa5...4ef58e )
by Simon
06:26
created

DocumentFactoryExtension::updateDefaultFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace Firesphere\SolrPermissions\Extensions;
5
6
7
use Firesphere\SolrSearch\Factories\DocumentFactory;
8
use SilverStripe\Core\Extension;
9
use SilverStripe\Dev\Debug;
10
use SilverStripe\ORM\DataObject;
11
use Solarium\Core\Query\AbstractDocument;
12
13
/**
14
 * Class \Firesphere\SolrPermissions\Extensions\DocumentFactoryExtension
15
 *
16
 * Extension class to add the default MemberView field to the Solr document
17
 *
18
 * @property DocumentFactory|DocumentFactoryExtension $owner
19
 */
20
class DocumentFactoryExtension extends Extension
21
{
22
23
    /**
24
     * Add the MemberView status to the default fields
25
     *
26
     * @param AbstractDocument $doc
27
     * @param DataObject|DataObjectExtension $item
28
     */
29
    public function updateDefaultFields($doc, $item)
30
    {
31
        $doc->addField('MemberView', $item->getMemberView());
0 ignored issues
show
Bug introduced by
The method addField() does not exist on Solarium\Core\Query\AbstractDocument. It seems like you code against a sub-type of Solarium\Core\Query\AbstractDocument such as Solarium\QueryType\Update\Query\Document. ( Ignorable by Annotation )

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

31
        $doc->/** @scrutinizer ignore-call */ 
32
              addField('MemberView', $item->getMemberView());
Loading history...
32
    }
33
}
34