1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Core\Content\LandingPage; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Content\Cms\CmsPageDefinition; |
6
|
|
|
use Shopware\Core\Content\LandingPage\Aggregate\LandingPageSalesChannel\LandingPageSalesChannelDefinition; |
7
|
|
|
use Shopware\Core\Content\LandingPage\Aggregate\LandingPageTag\LandingPageTagDefinition; |
8
|
|
|
use Shopware\Core\Content\LandingPage\Aggregate\LandingPageTranslation\LandingPageTranslationDefinition; |
9
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition; |
10
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField; |
11
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField; |
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\Flag\SearchRanking; |
15
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField; |
16
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToManyAssociationField; |
17
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField; |
18
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField; |
19
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField; |
20
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Field\VersionField; |
21
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; |
22
|
|
|
use Shopware\Core\System\SalesChannel\SalesChannelDefinition; |
23
|
|
|
use Shopware\Core\System\Tag\TagDefinition; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @internal (flag:FEATURE_NEXT_12032) |
27
|
|
|
*/ |
28
|
|
|
class LandingPageDefinition extends EntityDefinition |
29
|
|
|
{ |
30
|
|
|
public const ENTITY_NAME = 'landing_page'; |
31
|
|
|
|
32
|
|
|
public function getEntityName(): string |
33
|
|
|
{ |
34
|
|
|
return self::ENTITY_NAME; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getCollectionClass(): string |
38
|
|
|
{ |
39
|
|
|
return LandingPageCollection::class; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function getEntityClass(): string |
43
|
|
|
{ |
44
|
|
|
return LandingPageEntity::class; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function since(): ?string |
48
|
|
|
{ |
49
|
|
|
// May insert correct since-value |
50
|
|
|
return '6.3.5.0'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
protected function defineFields(): FieldCollection |
54
|
|
|
{ |
55
|
|
|
return new FieldCollection([ |
56
|
|
|
(new IdField('id', 'id'))->addFlags(new PrimaryKey(), new Required()), |
57
|
|
|
new VersionField(), |
58
|
|
|
new BoolField('active', 'active'), |
59
|
|
|
(new TranslatedField('name'))->addFlags(new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING)), |
60
|
|
|
new TranslatedField('customFields'), |
61
|
|
|
new TranslatedField('slotConfig'), |
62
|
|
|
new TranslatedField('metaTitle'), |
63
|
|
|
new TranslatedField('metaDescription'), |
64
|
|
|
new TranslatedField('keywords'), |
65
|
|
|
(new TranslationsAssociationField(LandingPageTranslationDefinition::class, 'landing_page_id'))->addFlags(new Required()), |
66
|
|
|
new ManyToManyAssociationField('tags', TagDefinition::class, LandingPageTagDefinition::class, 'landing_page_id', 'tag_id'), |
67
|
|
|
new FkField('cms_page_id', 'cmsPageId', CmsPageDefinition::class), |
68
|
|
|
new ManyToOneAssociationField('cmsPage', 'cms_page_id', CmsPageDefinition::class, 'id', false), |
69
|
|
|
new ManyToManyAssociationField('salesChannels', SalesChannelDefinition::class, LandingPageSalesChannelDefinition::class, 'landing_page_id', 'sales_channel_id'), |
70
|
|
|
]); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|