shlink/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Domain.php

27 lines
703 B
PHP
Raw Normal View History

2019-09-30 12:42:27 -05:00
<?php
2019-10-05 10:26:10 -05:00
2019-09-30 12:42:27 -05:00
declare(strict_types=1);
namespace Shlinkio\Shlink\Core;
use Doctrine\DBAL\Types\Types;
2019-09-30 12:42:27 -05:00
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata;
2019-09-30 12:42:27 -05:00
return static function (ClassMetadata $metadata, array $emConfig): void {
$builder = new ClassMetadataBuilder($metadata);
2019-09-30 12:42:27 -05:00
$builder->setTable(determineTableName('domains', $emConfig));
2019-09-30 12:42:27 -05:00
$builder->createField('id', Types::BIGINT)
->columnName('id')
->makePrimaryKey()
->generatedValue('IDENTITY')
->option('unsigned', true)
->build();
2019-09-30 12:42:27 -05:00
$builder->createField('authority', Types::STRING)
->unique()
->build();
};