These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Application\Migrations; |
||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; |
||
6 | use Doctrine\DBAL\Schema\Schema; |
||
7 | |||
8 | /** |
||
9 | * Migration to add impressum and tos to the page table. |
||
10 | */ |
||
11 | View Code Duplication | class Version20170526212910 extends AbstractMigration |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | /** |
||
14 | * @param Schema $schema |
||
15 | * |
||
16 | * @return void |
||
17 | */ |
||
18 | public function up(Schema $schema) |
||
19 | { |
||
20 | $this->abortIf( |
||
21 | $this->connection->getDatabasePlatform()->getName() != 'mysql', |
||
22 | 'Migration can only be executed safely on \'mysql\'.' |
||
23 | ); |
||
24 | |||
25 | $this->addSql(" |
||
26 | INSERT INTO page (slug, meta_keywords, meta_description, meta_social, updated_at, active) |
||
27 | VALUE ('impressum','','','', NOW(),1); |
||
28 | |||
29 | INSERT INTO page (slug, meta_keywords, meta_description, meta_social, updated_at, active) |
||
30 | VALUE ('tos','','','',NOW(),1); |
||
31 | "); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param Schema $schema |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | public function down(Schema $schema) |
||
40 | { |
||
41 | } |
||
42 | } |
||
43 |
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.