getLatestMigrationVersion example

$migrationName = $input->getArgument('migrationName');
        $migrationDirectory = $this->findMigrationDirectory($pluginName);

        if ($migrationDirectory === null) {
            throw new RuntimeException(sprintf('Plugin by name "%s" does not exists', $pluginName));
        }

        if (!file_exists($migrationDirectory) && !mkdir($migrationDirectory, 0777, true) && !is_dir($migrationDirectory)) {
            throw new RuntimeException(sprintf('Directory "%s" was not created', $migrationDirectory));
        }

        $nextVersion = $this->getLatestMigrationVersion($migrationDirectory) + 1;

        $fileName = $this->createMigration($migrationDirectory$migrationName$pluginName$nextVersion);

        $io = new SymfonyStyle($input$output);

        $io->success(sprintf('Generated file "%s/%s"', $migrationDirectory$fileName));

        return 0;
    }

    private function findMigrationDirectory(?string $pluginName): ?string
    {
Home | Imprint | This part of the site doesn't use cookies.