DoctrineMigrationsBundle: migrate command ContextErrorException Notice: Undefined offset: 1

Hi,

It’s my first time with this bundle, when I try to install and use it I have the following probleme:

bin/console doctrine:migrations:diff Generated new migration class to “D:\Projects\proarti2\app/DoctrineMigrations/Version20160311225100.php” from schema differences.

bin/console doctrine:migrations:migrate -vvv [2016-03-12 00:11:33] event.DEBUG: Notified event “console.command” to listener “Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure”. [2016-03-12 00:11:33] event.DEBUG: Notified event “console.command” to listener “Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand”. [2016-03-12 00:11:33] event.DEBUG: Notified event “console.command” to listener “Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand”.

                Application Migrations

[2016-03-12 00:11:34] doctrine.DEBUG: SELECT quote_ident(table_name) AS table_name, table_schema AS schema_name FROM information_schema.tables WHERE table_schema NOT LIKE ‘pg_%’ AND table_schema != ‘information_schema’ AND table_name != ‘geometry_columns’ AND table_name != ‘spatial_ref_sys’ AND table_type != ‘VIEW’ [2016-03-12 00:11:34] doctrine.DEBUG: SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ ‘^pg_.*’ and nspname != ‘information_schema’ [2016-03-12 00:11:34] doctrine.DEBUG: SHOW search_path [2016-03-12 00:11:34] doctrine.DEBUG: SELECT version FROM migration_versions WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y [2016-03-12 00:11:36] doctrine.DEBUG: SELECT version FROM migration_versions WHERE version IN (‘20160311225100’) ORDER BY version DESC LIMIT 1 [2016-03-12 00:11:36] doctrine.DEBUG: SELECT version FROM migration_versions Migrating up to 20160311225100 from 0 [2016-03-12 00:11:36] doctrine.DEBUG: “START TRANSACTION” Migration 20160311225100 failed during Pre-Checks. Error Notice: Undefined offset: 1 [2016-03-12 00:11:36] doctrine.DEBUG: “ROLLBACK”

[Symfony\Component\Debug\Exception\ContextErrorException] Notice: Undefined offset: 1

Exception trace: () at D:\Projects\proarti2\vendor\zendframework\zend-code\src\Generator\MethodGenerator.php:98 Symfony\Component\Debug\ErrorHandler->handleError() at D:\Projects\proarti2\vendor\zendframework\zend-code\src\Generator\MethodGenerator.php:98 Zend\Code\Generator\MethodGenerator::clearBodyIndention() at D:\Projects\proarti2\vendor\zendframework\zend-code\src\Generator\MethodGenerator.php:77 Zend\Code\Generator\MethodGenerator::fromReflection() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\Generator\MethodGenerator.php:39 ProxyManager\Generator\MethodGenerator::fromReflection() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\LazyLoadingMethodInterceptor.php:48 ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\LazyLoadingMethodInterceptor::generateMethod() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator.php:118 ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator->ProxyManager\ProxyGenerator{closure}() at n/a:n/a array_map() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator.php:90 ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator->generate() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\Factory\AbstractBaseFactory.php:119 ProxyManager\Factory\AbstractBaseFactory->generateProxyClass() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\Factory\AbstractBaseFactory.php:82 ProxyManager\Factory\AbstractBaseFactory->generateProxy() at D:\Projects\proarti2\vendor\ocramius\proxy-manager\src\ProxyManager\Factory\LazyLoadingValueHolderFactory.php:45 ProxyManager\Factory\LazyLoadingValueHolderFactory->createProxy() at D:\Projects\proarti2\vendor\doctrine\migrations\lib\Doctrine\DBAL\Migrations\Provider\LazySchemaDiffProvider.php:66 Doctrine\DBAL\Migrations\Provider\LazySchemaDiffProvider->createFromSchema() at D:\Projects\proarti2\vendor\doctrine\migrations\lib\Doctrine\DBAL\Migrations\Version.php:277 Doctrine\DBAL\Migrations\Version->execute() at D:\Projects\proarti2\vendor\doctrine\migrations\lib\Doctrine\DBAL\Migrations\Migration.php:176 Doctrine\DBAL\Migrations\Migration->migrate() at D:\Projects\proarti2\vendor\doctrine\migrations\lib\Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand.php:143 Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand->execute() at D:\Projects\proarti2\vendor\doctrine\doctrine-migrations-bundle\Command\MigrationsMigrateDoctrineCommand.php:54 Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand->execute() at D:\Projects\proarti2\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:259 Symfony\Component\Console\Command\Command->run() at D:\Projects\proarti2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:860 Symfony\Component\Console\Application->doRunCommand() at D:\Projects\proarti2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:192 Symfony\Component\Console\Application->doRun() at D:\Projects\proarti2\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:92 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at D:\Projects\proarti2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:123 Symfony\Component\Console\Application->run() at D:\Projects\proarti2\bin\console:29

doctrine:migrations:migrate [–write-sql] [–dry-run] [–query-time] [–allow-no-migration] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–] <command> [<version>]

My config: Symfony2.8.3 PHP7.0.4

composer require 👍


    "symfony/symfony": "^2.8",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-migrations-bundle": "^1.1",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "symfony/assetic-bundle": "^2",
    "sensio/distribution-bundle": "~5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",

I’ve done something wrong ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 28 (14 by maintainers)

Most upvoted comments

PHP_EOL replacement by “\n” in Zend\Code\Reflection\MethodReflection\MethodGenerator solved the problem for me too on win7x64

Fore your information (whenever you’re back from vacation 😉 )

Changing MethodReflection:231 from “\n” to PHP_EOL solved the issue on my first test, no idea what kind of side effects this will have though 😛

Also, all my files all my files are CRLF, files I have created myself, and created with symfony’s generate:controller/command etc

When doing doctrine:migrate:generate/diff it creates files where line endings are always LF

sorry I put single quote 😒 , it works :

    $lines = explode("\n", $body);

I replaced PHP_EOL with “\n” and the probleme persist , he don t know explode 😒