mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-25 10:20:18 -06:00
Updated entities mapping config so that they return a function
This commit is contained in:
parent
a737eed5c5
commit
96350c8b8f
@ -47,7 +47,7 @@
|
|||||||
"phly/phly-event-dispatcher": "^1.0",
|
"phly/phly-event-dispatcher": "^1.0",
|
||||||
"predis/predis": "^1.1",
|
"predis/predis": "^1.1",
|
||||||
"pugx/shortid-php": "^0.5",
|
"pugx/shortid-php": "^0.5",
|
||||||
"shlinkio/shlink-common": "^2.6.0",
|
"shlinkio/shlink-common": "^2.7.0",
|
||||||
"shlinkio/shlink-event-dispatcher": "^1.3",
|
"shlinkio/shlink-event-dispatcher": "^1.3",
|
||||||
"shlinkio/shlink-installer": "^4.0.1",
|
"shlinkio/shlink-installer": "^4.0.1",
|
||||||
"shlinkio/shlink-ip-geolocation": "^1.3.1",
|
"shlinkio/shlink-ip-geolocation": "^1.3.1",
|
||||||
|
@ -9,6 +9,7 @@ return [
|
|||||||
'entity_manager' => [
|
'entity_manager' => [
|
||||||
'orm' => [
|
'orm' => [
|
||||||
'proxies_dir' => 'data/proxies',
|
'proxies_dir' => 'data/proxies',
|
||||||
|
'load_mappings_using_functional_style' => true,
|
||||||
],
|
],
|
||||||
'connection' => [
|
'connection' => [
|
||||||
'user' => '',
|
'user' => '',
|
||||||
|
@ -6,9 +6,9 @@ namespace Shlinkio\Shlink\Core;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('domains');
|
$builder->setTable('domains');
|
||||||
@ -23,3 +23,4 @@ $builder->createField('id', Types::BIGINT)
|
|||||||
$builder->createField('authority', Types::STRING)
|
$builder->createField('authority', Types::STRING)
|
||||||
->unique()
|
->unique()
|
||||||
->build();
|
->build();
|
||||||
|
};
|
||||||
|
@ -6,10 +6,10 @@ namespace Shlinkio\Shlink\Core;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('short_urls')
|
$builder->setTable('short_urls')
|
||||||
@ -68,3 +68,4 @@ $builder->createManyToOne('domain', Entity\Domain::class)
|
|||||||
->build();
|
->build();
|
||||||
|
|
||||||
$builder->addUniqueConstraint(['short_code', 'domain_id'], 'unique_short_code_plus_domain');
|
$builder->addUniqueConstraint(['short_code', 'domain_id'], 'unique_short_code_plus_domain');
|
||||||
|
};
|
||||||
|
@ -6,9 +6,9 @@ namespace Shlinkio\Shlink\Core;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('tags')
|
$builder->setTable('tags')
|
||||||
@ -24,3 +24,4 @@ $builder->createField('id', Types::BIGINT)
|
|||||||
$builder->createField('name', Types::STRING)
|
$builder->createField('name', Types::STRING)
|
||||||
->unique()
|
->unique()
|
||||||
->build();
|
->build();
|
||||||
|
};
|
||||||
|
@ -6,11 +6,11 @@ namespace Shlinkio\Shlink\Core;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
||||||
use Shlinkio\Shlink\Core\Model\Visitor;
|
use Shlinkio\Shlink\Core\Model\Visitor;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('visits')
|
$builder->setTable('visits')
|
||||||
@ -52,3 +52,4 @@ $builder->createManyToOne('visitLocation', Entity\VisitLocation::class)
|
|||||||
->addJoinColumn('visit_location_id', 'id', true, false, 'Set NULL')
|
->addJoinColumn('visit_location_id', 'id', true, false, 'Set NULL')
|
||||||
->cascadePersist()
|
->cascadePersist()
|
||||||
->build();
|
->build();
|
||||||
|
};
|
||||||
|
@ -6,9 +6,9 @@ namespace Shlinkio\Shlink\Core;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('visit_locations');
|
$builder->setTable('visit_locations');
|
||||||
@ -44,3 +44,4 @@ $builder->createField('longitude', Types::FLOAT)
|
|||||||
->columnName('lon')
|
->columnName('lon')
|
||||||
->nullable(false)
|
->nullable(false)
|
||||||
->build();
|
->build();
|
||||||
|
};
|
||||||
|
@ -6,10 +6,10 @@ namespace Shlinkio\Shlink\Rest;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
||||||
|
|
||||||
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
return static function (ClassMetadata $metadata): void {
|
||||||
$builder = new ClassMetadataBuilder($metadata);
|
$builder = new ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
$builder->setTable('api_keys');
|
$builder->setTable('api_keys');
|
||||||
@ -32,3 +32,4 @@ $builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME)
|
|||||||
|
|
||||||
$builder->createField('enabled', Types::BOOLEAN)
|
$builder->createField('enabled', Types::BOOLEAN)
|
||||||
->build();
|
->build();
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user