|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\TrackEAttemptQualify; |
|
10
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
|
11
|
|
|
use Doctrine\DBAL\Schema\Schema; |
|
12
|
|
|
|
|
13
|
|
|
class Version20230321164019 extends AbstractMigrationChamilo |
|
14
|
|
|
{ |
|
15
|
|
|
public function getDescription(): string |
|
16
|
|
|
{ |
|
17
|
|
|
return 'Migrate track_e_attempt_recording'; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function up(Schema $schema): void |
|
21
|
|
|
{ |
|
22
|
|
|
$container = $this->getContainer(); |
|
23
|
|
|
$doctrine = $container->get('doctrine'); |
|
24
|
|
|
$em = $doctrine->getManager(); |
|
25
|
|
|
|
|
26
|
|
|
$sql = 'SELECT * FROM track_e_attempt_recording'; |
|
27
|
|
|
$connection = $this->getEntityManager()->getConnection(); |
|
28
|
|
|
$result = $connection->executeQuery($sql); |
|
29
|
|
|
$items = $result->fetchAllAssociative(); |
|
30
|
|
|
|
|
31
|
|
|
foreach ($items as $item) { |
|
32
|
|
|
$trackQualify = new TrackEAttemptQualify(); |
|
33
|
|
|
$trackQualify |
|
34
|
|
|
->setExeId($item['exe_id']) |
|
|
|
|
|
|
35
|
|
|
->setQuestionId($item['question_id']) |
|
36
|
|
|
->setAnswer($item['answer']) |
|
37
|
|
|
->setMarks((int) $item['marks']) |
|
38
|
|
|
->setAuthor($item['author']) |
|
39
|
|
|
->setTeacherComment($item['teacher_comment']) |
|
40
|
|
|
->setSessionId($item['session_id']) |
|
41
|
|
|
; |
|
42
|
|
|
$em->persist($trackQualify); |
|
43
|
|
|
$em->flush(); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function down(Schema $schema): void |
|
48
|
|
|
{ |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.