Passed
Push — master ( 92b241...4b9fa8 )
by Christian
15:20 queued 04:13
created

IntegrationRoleDefinition::getEntityName()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
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