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

Version20201212114910::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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