diff --git a/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php b/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php index 7ef501b69b..b519265d10 100644 --- a/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php +++ b/src/Chamilo/CoreBundle/Migrations/AbstractMigrationChamilo.php @@ -1,4 +1,5 @@ setVariable($variable); - $setting->setSubkey($subKey); - $setting->setType($type); - $setting->setCategory($category); - $setting->setSelectedValue($selectedValue); - $setting->setTitle($title); - $setting->setComment($comment); - $setting->setScope($scope); - $setting->setSubkeytext($subKeyText); - $setting->setAccessUrl($accessUrl); - $setting->setAccessUrlChangeable($accessUrlChangeable); - $setting->setAccessUrlLocked($accessUrlLocked); + $setting + ->setVariable($variable) + ->setSubkey($subKey) + ->setType($type) + ->setCategory($category) + ->setSelectedValue($selectedValue) + ->setTitle($title) + ->setComment($comment) + ->setScope($scope) + ->setSubkeytext($subKeyText) + ->setAccessUrl($accessUrl) + ->setAccessUrlChangeable($accessUrlChangeable) + ->setAccessUrlLocked($accessUrlLocked); + $this->getEntityManager()->persist($setting); $this->getEntityManager()->flush(); + if (count($options) > 0) { foreach ($options as $option) { - $option = new SettingsOptions(); - $option->setVariable($variable); - $option->setValue($option['value']); if (empty($option['text'])) { if ($option['value'] == 'true') { $option['text'] = 'Yes'; @@ -89,8 +92,12 @@ abstract class AbstractMigrationChamilo extends AbstractMigration $option['text'] = 'No'; } } - $option->setDisplayText($option['text']); - $this->getEntityManager()->persis($option); + $settingOption = new SettingsOptions(); + $settingOption + ->setVariable($variable) + ->setValue($option['value']) + ->setDisplayText($option['text']); + $this->getEntityManager()->persist($settingOption); $this->getEntityManager()->flush(); } }