1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Core\System\Integration\Aggregate\IntegrationRole; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\Api\Acl\Role\AclRoleDefinition; |
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\ManyToOneAssociationField; |
10
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; |
11
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\MappingEntityDefinition; |
12
|
|
|
use Shopware\Core\System\Integration\IntegrationDefinition; |
13
|
|
|
|
14
|
|
|
class IntegrationRoleDefinition extends MappingEntityDefinition |
15
|
|
|
{ |
16
|
|
|
public const ENTITY_NAME = 'integration_role'; |
17
|
|
|
|
18
|
|
|
public function getEntityName(): string |
19
|
|
|
{ |
20
|
|
|
return self::ENTITY_NAME; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
protected function defineFields(): FieldCollection |
24
|
|
|
{ |
25
|
|
|
return new FieldCollection([ |
26
|
|
|
(new FkField('integration_id', 'integrationId', IntegrationDefinition::class))->addFlags(new PrimaryKey(), new Required()), |
27
|
|
|
(new FkField('acl_role_id', 'aclRoleId', AclRoleDefinition::class))->addFlags(new PrimaryKey(), new Required()), |
28
|
|
|
|
29
|
|
|
new ManyToOneAssociationField('integration', 'integration_id', IntegrationDefinition::class, 'id', false), |
30
|
|
|
new ManyToOneAssociationField('role', 'acl_role_id', AclRoleDefinition::class, 'id', false), |
31
|
|
|
]); |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
|