SchemaTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A overrideRemoveNamespacedAssets() 0 9 2
A overrideSchemaDiff() 0 9 2
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\Tools;
4
5
trait SchemaTrait
6
{
7
    /**
8
     * Unfortunately due a poor design of the Doctrine\ORM\Tools\SchemaTool::getSchemaFromMetadata
9
     * we have to use "class_alias" to replace "Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"
10
     * with "RDV\Bundle\EntityExtendBundle\Tools\ExtendSchemaUpdateRemoveNamespacedAssets".
11
     */
12
    public function overrideRemoveNamespacedAssets()
13
    {
14
        if (!class_exists('Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets', false)) {
15
            class_alias(
16
                'RDV\Bundle\EntityExtendBundle\Tools\ExtendSchemaUpdateRemoveNamespacedAssets',
17
                'Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets'
18
            );
19
        }
20
    }
21
22
    /**
23
     * to disable automatic rename of autogenerated indices
24
     * we have to use "class_alias" to replace "Doctrine\DBAL\Schema\SchemaDiff"
25
     * with "RDV\Bundle\MigrationBundle\Migration\Schema\SchemaDiff"
26
     */
27
    public function overrideSchemaDiff()
28
    {
29
        if (!class_exists('Doctrine\DBAL\Schema\SchemaDiff', false)) {
30
            class_alias(
31
                'RDV\Bundle\MigrationBundle\Migration\Schema\SchemaDiff',
32
                'Doctrine\DBAL\Schema\SchemaDiff'
33
            );
34
        }
35
    }
36
}
37