Moved entities mappings from annotations to external config files

This commit is contained in:
Alejandro Celaya
2018-12-16 12:08:03 +01:00
parent fb705b44a4
commit a28c1d17c5
13 changed files with 244 additions and 172 deletions

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Rest;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata;
use Shlinkio\Shlink\Common\Type\ChronosDateTimeType;
/** @var $metadata ClassMetadata */
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('api_keys');
$builder->createField('id', Type::BIGINT)
->makePrimaryKey()
->generatedValue('IDENTITY')
->option('unsigned', true)
->build();
$builder->createField('key', Type::STRING)
->columnName('`key`')
->unique()
->build();
$builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME)
->columnName('expiration_date')
->nullable()
->build();
$builder->createField('enabled', Type::BOOLEAN)
->build();

View File

@@ -5,8 +5,8 @@ return [
'entity_manager' => [
'orm' => [
'entities_paths' => [
__DIR__ . '/../src/Entity',
'entities_mappings' => [
__DIR__ . '/../config/entities-mappings',
],
],
],