1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Core\Content\Product\Aggregate\ProductMedia; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Content\Media\MediaDefinition; |
6
|
|
|
use Shopware\Core\Content\Product\ProductDefinition; |
7
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition; |
8
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\CustomFields; |
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\ReverseInherited; |
14
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\SetNullOnDelete; |
15
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField; |
16
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField; |
17
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField; |
18
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToManyAssociationField; |
19
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\ReferenceVersionField; |
20
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\VersionField; |
21
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; |
22
|
|
|
use Shopware\Core\Framework\Log\Package; |
23
|
|
|
|
24
|
|
|
#[Package('inventory')] |
25
|
|
|
class ProductMediaDefinition extends EntityDefinition |
26
|
|
|
{ |
27
|
|
|
final public const ENTITY_NAME = 'product_media'; |
28
|
|
|
|
29
|
|
|
public function getEntityName(): string |
30
|
|
|
{ |
31
|
|
|
return self::ENTITY_NAME; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getCollectionClass(): string |
35
|
|
|
{ |
36
|
|
|
return ProductMediaCollection::class; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getEntityClass(): string |
40
|
|
|
{ |
41
|
|
|
return ProductMediaEntity::class; |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function since(): ?string |
45
|
|
|
{ |
46
|
|
|
return '6.0.0.0'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getHydratorClass(): string |
50
|
|
|
{ |
51
|
|
|
return ProductMediaHydrator::class; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
protected function getParentDefinitionClass(): ?string |
55
|
|
|
{ |
56
|
|
|
return ProductDefinition::class; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
protected function defineFields(): FieldCollection |
60
|
|
|
{ |
61
|
|
|
return new FieldCollection([ |
62
|
|
|
(new IdField('id', 'id'))->addFlags(new ApiAware(), new PrimaryKey(), new Required()), |
63
|
|
|
(new VersionField())->addFlags(new ApiAware()), |
64
|
|
|
|
65
|
|
|
(new FkField('product_id', 'productId', ProductDefinition::class))->addFlags(new ApiAware(), new Required()), |
66
|
|
|
(new ReferenceVersionField(ProductDefinition::class))->addFlags(new ApiAware(), new Required()), |
67
|
|
|
|
68
|
|
|
(new FkField('media_id', 'mediaId', MediaDefinition::class))->addFlags(new ApiAware(), new Required()), |
69
|
|
|
(new IntField('position', 'position'))->addFlags(new ApiAware()), |
70
|
|
|
(new ManyToOneAssociationField('product', 'product_id', ProductDefinition::class, 'id', false))->addFlags(new ReverseInherited('media')), |
71
|
|
|
(new ManyToOneAssociationField('media', 'media_id', MediaDefinition::class, 'id', true))->addFlags(new ApiAware()), |
72
|
|
|
(new OneToManyAssociationField('coverProducts', ProductDefinition::class, 'product_media_id'))->addFlags(new SetNullOnDelete(false)), |
73
|
|
|
(new CustomFields())->addFlags(new ApiAware()), |
74
|
|
|
]); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths