Merge pull request #1545 from bolt/fix/table-prefix-went-missing-with-symfony/proxy-manager-bridge

After adding `symfony/proxy-manager-bridge`, table prefix went missing
This commit is contained in:
Ivo Valchev
2020-06-24 09:59:31 +02:00
committed by GitHub
5 changed files with 18 additions and 8 deletions

View File

@@ -23,7 +23,6 @@ return [
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true, 'test' => true, 'local' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symplify\ConsoleColorDiff\ConsoleColorDiffBundle::class => ['dev' => true, 'test' => true],
Symplify\ConsoleColorDiff\ConsoleColorDiffBundle::class => ['dev' => true, 'test' => true],
Translation\Bundle\TranslationBundle::class => ['all' => true],
Translation\PlatformAdapter\Loco\Bridge\Symfony\TranslationAdapterLocoBundle::class => ['dev' => true, 'local' => true],
];

View File

@@ -1,3 +1,7 @@
services:
monolog.processor.request:
synthetic: true
_defaults:
autowire: true
autoconfigure: true
monolog.processor.request:
synthetic: true

View File

@@ -19,7 +19,7 @@ class TablePrefix
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
{
if ($tablePrefix = $this->getTablePrefix($eventArgs->getEntityManager())) {
if ($tablePrefix = $this->getTablePrefix()) {
$classMetadata = $eventArgs->getClassMetadata();
if (! $classMetadata->isInheritanceTypeSingleTable()

View File

@@ -46,10 +46,14 @@ trait TablePrefixTrait
return $this;
}
protected function getTablePrefix(ObjectManager $manager)
/**
* Since we introduced `symfony/proxy-manager-bridge`, the keys in the tableprefix
* no longer match what the manager tells us it should be. For example, the
* given key was `0000000005ee10ad0000000043b453e3`, but in our reference
* table we had `0000000005ee10e90000000043b453e3`. We just return the first one, now
*/
protected function getTablePrefix(): string
{
$key = spl_object_hash($manager);
return $this->tablePrefixes[$key] ?? '';
return current($this->tablePrefixes) ?? '';
}
}

View File

@@ -894,6 +894,9 @@
"symfony/property-info": {
"version": "v4.4.4"
},
"symfony/proxy-manager-bridge": {
"version": "v4.4.10"
},
"symfony/routing": {
"version": "4.2",
"recipe": {