1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OroCRM\Bundle\CallBundle\Migrations\Schema\v1_6; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Schema\Schema; |
6
|
|
|
|
7
|
|
|
use Oro\Bundle\MigrationBundle\Migration\Migration; |
8
|
|
|
use Oro\Bundle\MigrationBundle\Migration\QueryBag; |
9
|
|
|
|
10
|
|
|
class OroCRMCallBundle implements Migration |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* {@inheritdoc} |
14
|
|
|
*/ |
15
|
|
|
public function up(Schema $schema, QueryBag $queries) |
16
|
|
|
{ |
17
|
|
|
self::createCallDirectionTranslationTable($schema); |
18
|
|
|
self::createCallStatusTranslationTable($schema); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Generate table orocrm_call_direction_trans |
23
|
|
|
* |
24
|
|
|
* @param Schema $schema |
25
|
|
|
*/ |
26
|
|
View Code Duplication |
public static function createCallDirectionTranslationTable(Schema $schema) |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
/** Generate table orocrm_call_direction_trans **/ |
29
|
|
|
$table = $schema->createTable('orocrm_call_direction_trans'); |
30
|
|
|
$table->addColumn('id', 'integer', array('autoincrement' => true)); |
31
|
|
|
$table->addColumn('foreign_key', 'string', array('length' => 32)); |
32
|
|
|
$table->addColumn('content', 'string', array('length' => 255)); |
33
|
|
|
$table->addColumn('locale', 'string', array('length' => 8)); |
34
|
|
|
$table->addColumn('object_class', 'string', array('length' => 255)); |
35
|
|
|
$table->addColumn('field', 'string', array('length' => 32)); |
36
|
|
|
$table->setPrimaryKey(array('id')); |
37
|
|
|
$table->addIndex( |
38
|
|
|
array('locale', 'object_class', 'field', 'foreign_key'), |
39
|
|
|
'call_direction_translation_idx', |
40
|
|
|
array() |
41
|
|
|
); |
42
|
|
|
/** End of generate table orocrm_call_direction_trans **/ |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Generate table orocrm_call_status_trans |
47
|
|
|
* |
48
|
|
|
* @param Schema $schema |
49
|
|
|
*/ |
50
|
|
View Code Duplication |
public static function createCallStatusTranslationTable(Schema $schema) |
|
|
|
|
51
|
|
|
{ |
52
|
|
|
/** Generate table orocrm_call_status_trans **/ |
53
|
|
|
$table = $schema->createTable('orocrm_call_status_trans'); |
54
|
|
|
$table->addColumn('id', 'integer', array('autoincrement' => true)); |
55
|
|
|
$table->addColumn('foreign_key', 'string', array('length' => 32)); |
56
|
|
|
$table->addColumn('content', 'string', array('length' => 255)); |
57
|
|
|
$table->addColumn('locale', 'string', array('length' => 8)); |
58
|
|
|
$table->addColumn('object_class', 'string', array('length' => 255)); |
59
|
|
|
$table->addColumn('field', 'string', array('length' => 32)); |
60
|
|
|
$table->setPrimaryKey(array('id')); |
61
|
|
|
$table->addIndex( |
62
|
|
|
array('locale', 'object_class', 'field', 'foreign_key'), |
63
|
|
|
'call_status_translation_idx', |
64
|
|
|
array() |
65
|
|
|
); |
66
|
|
|
/** End of generate table orocrm_call_status_trans **/ |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.