Passed
Push — trunk ( cca91d...e2f74b )
by Christian
13:28 queued 13s
created

TaxProviderDefinition::getEntityName()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\System\TaxProvider;
4
5
use Shopware\Core\Content\Rule\RuleDefinition;
6
use Shopware\Core\Framework\App\AppDefinition;
7
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
8
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
9
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField;
10
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
11
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
12
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
13
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\RestrictDelete;
14
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
15
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField;
16
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField;
17
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField;
18
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField;
19
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField;
20
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
21
use Shopware\Core\System\TaxProvider\Aggregate\TaxProviderTranslation\TaxProviderTranslationDefinition;
22
23
/**
24
 * @package checkout
25
 */
26
class TaxProviderDefinition extends EntityDefinition
27
{
28
    public const ENTITY_NAME = 'tax_provider';
29
30
    public function getEntityName(): string
31
    {
32
        return self::ENTITY_NAME;
33
    }
34
35
    public function getCollectionClass(): string
36
    {
37
        return TaxProviderCollection::class;
38
    }
39
40
    public function getEntityClass(): string
41
    {
42
        return TaxProviderEntity::class;
0 ignored issues
show
Bug introduced by
The type Shopware\Core\System\TaxProvider\TaxProviderEntity 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...
43
    }
44
45
    public function since(): ?string
46
    {
47
        return '6.5.0.0';
48
    }
49
50
    public function getDefaults(): array
51
    {
52
        return [
53
            'position' => 1,
54
            'active' => true,
55
        ];
56
    }
57
58
    protected function defineFields(): FieldCollection
59
    {
60
        return new FieldCollection([
61
            (new IdField('id', 'id'))->addFlags(new ApiAware(), new PrimaryKey(), new Required()),
62
            (new StringField('identifier', 'identifier'))->addFlags(new Required()),
63
            (new BoolField('active', 'active'))->addFlags(new ApiAware()),
64
            (new TranslatedField('name'))->addFlags(new ApiAware()),
65
            (new BoolField('active', 'active'))->addFlags(new ApiAware()),
66
            (new IntField('priority', 'priority'))->addFlags(new Required(), new ApiAware()),
67
            (new StringField('process_url', 'processUrl'))->addFlags(new ApiAware()),
68
            (new FkField('availability_rule_id', 'availabilityRuleId', RuleDefinition::class)),
69
            (new FkField('app_id', 'appId', AppDefinition::class))->addFlags(new ApiAware()),
70
            (new TranslatedField('customFields'))->addFlags(new ApiAware()),
71
72
            (new TranslationsAssociationField(TaxProviderTranslationDefinition::class, 'tax_provider_id')),
73
            (new ManyToOneAssociationField('availabilityRule', 'availability_rule_id', RuleDefinition::class))->addFlags(new RestrictDelete()),
74
            (new ManyToOneAssociationField('app', 'app_id', AppDefinition::class)),
75
        ]);
76
    }
77
}
78