Version20150812230500.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V110;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Class Version20150812230500
  8. *
  9. * @package Application\Migrations\Schema\V11010
  10. */
  11. class Version20150812230500 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. */
  16. public function up(Schema $schema)
  17. {
  18. $this->addSettingCurrent(
  19. 'allow_coach_feedback_exercises',
  20. null,
  21. 'radio',
  22. 'Session',
  23. 'false',
  24. 'AllowCoachFeedbackExercisesTitle',
  25. 'AllowCoachFeedbackExercisesComment',
  26. null,
  27. null,
  28. 1,
  29. true,
  30. false,
  31. [
  32. ['value' => 'true', 'text' => 'Yes'],
  33. ['value' => 'false', 'text' => 'No']
  34. ]
  35. );
  36. }
  37. /**
  38. * @param Schema $schema
  39. */
  40. public function down(Schema $schema)
  41. {
  42. $entityManage = $this->getEntityManager();
  43. $deleteOptions = $entityManage->createQueryBuilder();
  44. $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
  45. ->andWhere(
  46. $deleteOptions->expr()->in(
  47. 'o.variable',
  48. [
  49. 'allow_coach_feedback_exercises'
  50. ]
  51. )
  52. );
  53. $deleteOptions->getQuery()->execute();
  54. $deleteSettings = $entityManage->createQueryBuilder();
  55. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  56. ->andWhere(
  57. $deleteSettings->expr()->in(
  58. 's.variable',
  59. [
  60. 'allow_coach_feedback_exercises'
  61. ]
  62. )
  63. );
  64. $deleteSettings->getQuery()->execute();
  65. }
  66. }