Skip to content
Snippets Groups Projects
Commit 61effe4a authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer Committed by Jan-Hendrik Willms
Browse files

Fix #3711.

Closes #3711

Merge request studip/studip!2585
parent b50d00e5
No related branches found
No related tags found
No related merge requests found
<?php <?php
namespace Studip\Cli\Commands\Migrate; namespace Studip\Cli\Commands\DB;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class MigrateMatrikelnummer extends Command class MoveMatrikelnummer extends Command
{ {
protected static $defaultName = 'migrate:matrikelnummer'; protected static $defaultName = 'db:move_matrikelnummer';
protected function configure() : void protected function configure(): void
{ {
$this->setDescription('Migrates the "Matrikelnummer" datafield into the matriculation_number column of the auth_user_md5 table.'); $this->setDescription(
$this->setHelp('This command migrates the "Matrikelnummer" datafield into the matriculation_number column of the auth_user_md5 table. The ID of the datafield must be provided. The datafield is not deleted in the migration process.'); 'Migrates the "Matrikelnummer" datafield into the matriculation_number column of the auth_user_md5 table.'
);
$this->setHelp(
'This command migrates the "Matrikelnummer" datafield into the matriculation_number column of the auth_user_md5 table. The ID of the datafield must be provided. The datafield is not deleted in the migration process.'
);
$this->addOption('id', 'i', InputOption::VALUE_REQUIRED, 'The ID of the "Matrikelnummer" datafield.', null); $this->addOption('id', 'i', InputOption::VALUE_REQUIRED, 'The ID of the "Matrikelnummer" datafield.', null);
} }
protected function execute(InputInterface $input, OutputInterface $output) : int protected function execute(InputInterface $input, OutputInterface $output): int
{ {
$datafield_id = $input->getOption('id'); $datafield_id = $input->getOption('id');
if (!$datafield_id) { if (!$datafield_id) {
...@@ -56,10 +60,7 @@ class MigrateMatrikelnummer extends Command ...@@ -56,10 +60,7 @@ class MigrateMatrikelnummer extends Command
} }
}; };
\DatafieldEntryModel::findEachByDatafield_id( \DatafieldEntryModel::findEachByDatafield_id($modifier, $datafield->id);
$modifier,
$datafield->id
);
return Command::SUCCESS; return Command::SUCCESS;
} }
......
...@@ -31,6 +31,7 @@ $commands = [ ...@@ -31,6 +31,7 @@ $commands = [
Commands\Cronjobs\CronjobWorker::class, Commands\Cronjobs\CronjobWorker::class,
Commands\Cronjobs\CronjobWorker::class, Commands\Cronjobs\CronjobWorker::class,
Commands\DB\Dump::class, Commands\DB\Dump::class,
Commands\DB\MoveMatrikelnummer::class,
Commands\Files\Dump::class, Commands\Files\Dump::class,
Commands\Fix\Biest7789::class, Commands\Fix\Biest7789::class,
Commands\Fix\Biest7866::class, Commands\Fix\Biest7866::class,
...@@ -38,7 +39,6 @@ $commands = [ ...@@ -38,7 +39,6 @@ $commands = [
Commands\Fix\EndTimeWeeklyRecurredEvents::class, Commands\Fix\EndTimeWeeklyRecurredEvents::class,
Commands\Fix\IconDimensions::class, Commands\Fix\IconDimensions::class,
Commands\HelpContent\Migrate::class, Commands\HelpContent\Migrate::class,
Commands\Migrate\MigrateMatrikelnummer::class,
Commands\Migrate\MigrateList::class, Commands\Migrate\MigrateList::class,
Commands\Migrate\MigrateStatus::class, Commands\Migrate\MigrateStatus::class,
Commands\Migrate\Migrate::class, Commands\Migrate\Migrate::class,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment