Passed
Push — 6.5.0.0 ( 27ba79...b0de28 )
by Christian
10:05 queued 12s
created

UserConfigDefinition::getParentDefinitionClass()   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 declare(strict_types=1);
2
3
namespace Shopware\Core\System\User\Aggregate\UserConfig;
4
5
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
6
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField;
7
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
8
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
9
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
10
use Shopware\Core\Framework\DataAbstractionLayer\Field\JsonField;
11
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField;
12
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField;
13
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
14
use Shopware\Core\Framework\Log\Package;
15
use Shopware\Core\System\User\UserDefinition;
16
17
#[Package('system-settings')]
18
class UserConfigDefinition extends EntityDefinition
19
{
20
    final public const ENTITY_NAME = 'user_config';
21
22
    public function getEntityName(): string
23
    {
24
        return self::ENTITY_NAME;
25
    }
26
27
    public function getEntityClass(): string
28
    {
29
        return UserConfigEntity::class;
0 ignored issues
show
Bug introduced by
The type Shopware\Core\System\Use...Config\UserConfigEntity 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...
30
    }
31
32
    public function getCollectionClass(): string
33
    {
34
        return UserConfigCollection::class;
35
    }
36
37
    public function since(): ?string
38
    {
39
        return '6.3.5.0';
40
    }
41
42
    protected function getParentDefinitionClass(): ?string
43
    {
44
        return UserDefinition::class;
45
    }
46
47
    protected function defineFields(): FieldCollection
48
    {
49
        return new FieldCollection([
50
            (new IdField('id', 'id'))->addFlags(new PrimaryKey(), new Required()),
51
            (new FkField('user_id', 'userId', UserDefinition::class))->addFlags(new Required()),
52
            (new StringField('key', 'key'))->addFlags(new Required()),
53
            (new JsonField('value', 'value')),
54
55
            (new ManyToOneAssociationField('user', 'user_id', UserDefinition::class, 'id', false)),
56
        ]);
57
    }
58
}
59