Passed
Push — master ( 804eb4...5e2840 )
by Julito
10:59
created

Version20201212114910   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A up() 0 13 3
1
<?php
2
3
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
4
5
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
6
use Doctrine\DBAL\Schema\Schema;
7
8
final class Version20201212114910 extends AbstractMigrationChamilo
9
{
10
    public function getDescription() : string
11
    {
12
        return 'Migrate content';
13
    }
14
15
    public function up(Schema $schema) : void
16
    {
17
        $connection = $this->getEntityManager()->getConnection();
18
19
        $sql = 'SELECT * FROM course';
20
        $result = $connection->executeQuery($sql);
21
        $data = $result->fetchAllAssociative();
22
        foreach ($data as $course) {
23
            $courseId = $course['id'];
24
            $sql = "SELECT * FROM c_document WHERE c_id = $courseId";
25
            $result = $connection->executeQuery($sql);
26
            $documents = $result->fetchAllAssociative();
27
            foreach ($documents as $document) {
28
                //$repo
29
            }
30
31
            //$this->addSql($sql);
32
        }
33
34
    }
35
}
36