Issues (22)

src/ORM/SiteTreeDataExtension.php (2 issues)

1
<?php
2
3
namespace Dynamic\ShortURL\ORM;
4
5
use Dynamic\ShortURL\Model\ShortURL;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\GridField\GridField;
8
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;
9
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
10
use SilverStripe\ORM\DataExtension;
11
use Symbiote\GridFieldExtensions\GridFieldAddExistingSearchButton;
0 ignored issues
show
The type Symbiote\GridFieldExtens...AddExistingSearchButton was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class SiteTreeDataExtension extends DataExtension
14
{
15
    /**
16
     * @var array
17
     */
18
    private static $many_many = [
0 ignored issues
show
The private property $many_many is not used, and could be removed.
Loading history...
19
        'ShortURLs' => ShortURL::class,
20
    ];
21
22
    public function updateCMSFields(FieldList $fields)
23
    {
24
        if ($this->owner->ID) {
25
            $config = GridFieldConfig_RelationEditor::create()
26
                ->removeComponentsByType(GridFieldAddExistingAutocompleter::class);
27
            $urlsField = GridField::create('ShortURLs', 'Campaign URLs', $this->owner->ShortURLs(), $config);
28
            $fields->addFieldsToTab('Root.Share', $urlsField);
29
        }
30
    }
31
}
32