Passed
Push — trunk ( 2d6001...da76dd )
by Christian
15:37 queued 13s
created

OrderLineItemDownloadDefinition::getEntityClass()   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\Checkout\Order\Aggregate\OrderLineItemDownload;
4
5
use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemDefinition;
6
use Shopware\Core\Content\Media\MediaDefinition;
7
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
8
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
9
use Shopware\Core\Framework\DataAbstractionLayer\Field\CustomFields;
10
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField;
11
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
12
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
13
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
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\ReferenceVersionField;
18
use Shopware\Core\Framework\DataAbstractionLayer\Field\VersionField;
19
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
20
21
class OrderLineItemDownloadDefinition extends EntityDefinition
22
{
23
    public const ENTITY_NAME = 'order_line_item_download';
24
25
    public function getEntityName(): string
26
    {
27
        return self::ENTITY_NAME;
28
    }
29
30
    public function getCollectionClass(): string
31
    {
32
        return OrderLineItemDownloadCollection::class;
33
    }
34
35
    public function getEntityClass(): string
36
    {
37
        return OrderLineItemDownloadEntity::class;
0 ignored issues
show
Bug introduced by
The type Shopware\Core\Checkout\O...rLineItemDownloadEntity 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...
38
    }
39
40
    public function since(): ?string
41
    {
42
        return '6.4.19.0';
43
    }
44
45
    protected function getParentDefinitionClass(): ?string
46
    {
47
        return OrderLineItemDefinition::class;
48
    }
49
50
    protected function defineFields(): FieldCollection
51
    {
52
        return new FieldCollection([
53
            (new IdField('id', 'id'))->addFlags(new ApiAware(), new PrimaryKey(), new Required()),
54
            (new VersionField())->addFlags(new ApiAware()),
55
56
            (new FkField('order_line_item_id', 'orderLineItemId', OrderLineItemDefinition::class))->addFlags(new ApiAware(), new Required()),
57
            (new ReferenceVersionField(OrderLineItemDefinition::class))->addFlags(new ApiAware(), new Required()),
58
59
            (new FkField('media_id', 'mediaId', MediaDefinition::class))->addFlags(new ApiAware(), new Required()),
60
            (new IntField('position', 'position'))->addFlags(new ApiAware(), new Required()),
61
            (new BoolField('access_granted', 'accessGranted'))->addFlags(new ApiAware(), new Required()),
62
63
            (new ManyToOneAssociationField('orderLineItem', 'order_line_item_id', OrderLineItemDefinition::class, 'id'))->addFlags(new ApiAware()),
64
            (new ManyToOneAssociationField('media', 'media_id', MediaDefinition::class, 'id'))->addFlags(new ApiAware()),
65
            (new CustomFields())->addFlags(new ApiAware()),
66
        ]);
67
    }
68
}
69