Version20160705192000.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V111;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\DBAL\Types\Type;
  7. /**
  8. * Class Version20160705192000
  9. * Add accumulate scorm time to c_lp table
  10. * @package Application\Migrations\Schema\V111
  11. */
  12. class Version20160705192000 extends AbstractMigrationChamilo
  13. {
  14. /**
  15. * @param Schema $schema
  16. * @throws \Doctrine\DBAL\DBALException
  17. * @throws \Doctrine\DBAL\Schema\SchemaException
  18. */
  19. public function up(Schema $schema)
  20. {
  21. $em = $this->getEntityManager();
  22. $result = $em
  23. ->getRepository('ChamiloCoreBundle:SettingsCurrent')
  24. ->findOneBy(['variable' => 'scorm_cumulative_session_time']);
  25. $cumulativeScormTime = 1;
  26. if ($result->getSelectedValue() === 'false') {
  27. $cumulativeScormTime = 0;
  28. }
  29. $this->addSql("UPDATE c_lp SET accumulate_scorm_time = $cumulativeScormTime");
  30. }
  31. /**
  32. * @param Schema $schema
  33. * @throws \Doctrine\DBAL\DBALException
  34. * @throws \Doctrine\DBAL\Schema\SchemaException
  35. */
  36. public function down(Schema $schema)
  37. {
  38. }
  39. }