dongtiao2105 2018-06-11 23:25
浏览 88

Symfony 3.4.11 doctrine注意:未初始化的字符串偏移量:0

I am using Symfony and I upgrade to 3.4.11.

But I have a big problem. When I run the command:

php bin/console doctrine:schema:update  --dump-sql

in the terminal I have the next error:

In ClassMetadataInfo.php line 1400:

  Notice: Uninitialized string offset: 0  

Really, I was search and readed the docs and I can't found the error.

Thanks very much

UPDATE

$ php bin/console doc:sch:va  -vvv

Mapping
-------


In ClassMetadataInfo.php line 1400:

  [Symfony\Component\Debug\Exception\ContextErrorException]  
  Notice: Uninitialized string offset: 0                     


Exception trace:
 Doctrine\ORM\Mapping\ClassMetadataInfo->_validateAndCompleteFieldMapping() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:2355

 Doctrine\ORM\Mapping\ClassMetadataInfo->mapField() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php:333

 Doctrine\ORM\Mapping\Driver\AnnotationDriver->loadMetadataForClass() at /home/devel/tests4/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php:102

 Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:151

 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /home/devel/tests4/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:333

 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78

 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at /home/devel/tests4/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:217

 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /home/devel/tests4/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:115

 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaValidator.php:68

 Doctrine\ORM\Tools\SchemaValidator->validateMapping() at /home/devel/tests4/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/ValidateSchemaCommand.php:69

 Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand->execute() at /home/devel/tests4/vendor/doctrine/doctrine-bundle/Command/Proxy/ValidateSchemaCommand.php:34

 Doctrine\Bundle\DoctrineBundle\Command\Proxy\ValidateSchemaCommand->execute() at /home/devel/tests4/vendor/symfony/console/Command/Command.php:251

 Symfony\Component\Console\Command\Command->run() at /home/devel/tests4/vendor/symfony/console/Application.php:964

 Symfony\Component\Console\Application->doRunCommand() at /home/devel/tests4/vendor/symfony/framework-bundle/Console/Application.php:86

 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /home/devel/tests4/vendor/symfony/console/Application.php:248

 Symfony\Component\Console\Application->doRun() at /home/devel/tests4/vendor/symfony/framework-bundle/Console/Application.php:74

 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/devel/tests4/vendor/symfony/console/Application.php:148

 Symfony\Component\Console\Application->run() at /home/devel/tests4/bin/console:39
  • 写回答

3条回答 默认 最新

  • duannuci4008 2018-06-12 11:44
    关注

    Thanks to everyone for try to help me.

    I fix my error and I found the correct answer here: https://plus.google.com/+KamilZabdyr/posts/fb5xYGyyyY8

    Here the quick fix to a very common error with ORM:

    PHP Notice: Uninitialized string offset: 0 in ?/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php

    Usually it's thrown because there is a ORM column name tag empty. So check all your model files for any empty name. E.g:

    @ORM\Column(name="", type="string", length=12)

    评论

报告相同问题?

悬赏问题

  • ¥15 给出完整的python代码并解释
  • ¥15 有人懂怎么做大模型的客服系统吗?卡住了卡住了
  • ¥20 firefly-rk3399上启动卡住了
  • ¥15 如何删除这个虚拟音频
  • ¥50 hyper默认的default switch
  • ¥15 网站打不开,提示502 Bad Gateway
  • ¥20 基于MATLAB的绝热压缩空气储能系统代码咨询
  • ¥15 R语言建立随机森林模型出现的问题
  • ¥15 关于#wpf#的问题:怎么更改LayoutGroup组件的标签页的字体颜色
  • ¥15 中级微观经济学,生产可能性边界问题