PHP致命错误:类';条令通用持久性映射驱动程序文件驱动程序';找不到


PHP Fatal error: Class 'DoctrineCommonPersistenceMappingDriverFileDriver' not found

我按照以下说明操作:http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html一步一步地运行Mongo服务器,但当我尝试这样做时:

php app/console generate:bundle --namespace=Acme/StoreBundle

我得到

Class 'Doctrine'Common'Persistence'Mapping'Driver'FileDriver' not found in /Users/username/Sites/myapp/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php on line 37

我认为我的parameters.ini文件可能有问题,该文件仍然提到MYSQL,但上面的链接没有提到任何内容:

[parameters]
    database_driver="pdo_mysql"
    database_host="localhost"
    database_port=""
    database_name="somedb"
    database_user="root"
    database_password="mypassword"
    mailer_transport="smtp"
    mailer_host="localhost"
    mailer_user=""
    mailer_password=""
    locale="en"
    secret="093faacf47bcdcdcdcdcdc9d152fc8b"

我做错了什么?

更新:

我下载了Doctrine Common,这是我的registerNameSpaces函数:

$loader->registerNamespaces(array(
    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    'Sensio'           => __DIR__.'/../vendor/bundles',
    'JMS'              => __DIR__.'/../vendor/bundles',
    'Doctrine''Common' => __DIR__.'/../vendor/doctrine-common/lib',
    'Doctrine''DBAL'   => __DIR__.'/../vendor/doctrine-dbal/lib',
    'Doctrine''ODM''MongoDB'    => __DIR__.'/../vendor/doctrine-mongodb-odm/lib',
    'Doctrine''MongoDB'         => __DIR__.'/../vendor/doctrine-mongodb/lib',
    'Doctrine'         => __DIR__.'/../vendor/doctrine/lib',
    'Monolog'          => __DIR__.'/../vendor/monolog/src',
    'Assetic'          => __DIR__.'/../vendor/assetic/src',
    'Metadata'         => __DIR__.'/../vendor/metadata/src',
    'FOS'              => __DIR__.'/../vendor/bundles',
    'FOS''Rest'        => __DIR__.'/../vendor/fos',
    'JMS'              => __DIR__.'/../vendor/bundles',
));

我的deps文件:

[symfony]
    git=http://github.com/symfony/symfony.git
    version=origin/2.0
[twig]
    git=http://github.com/fabpot/Twig.git
    version=v1.8.2
[monolog]
    git=http://github.com/Seldaek/monolog.git
    version=1.0.2
[doctrine-common]
    git=http://github.com/doctrine/common.git
    version=2.1.4
[doctrine-dbal]
    git=http://github.com/doctrine/dbal.git
    version=2.1.7
[doctrine]
    git=http://github.com/doctrine/doctrine2.git
    version=2.1.7
[swiftmailer]
    git=http://github.com/swiftmailer/swiftmailer.git
    version=v4.2.0
[assetic]
    git=http://github.com/kriswallsmith/assetic.git
    version=v1.0.3
[twig-extensions]
    git=http://github.com/fabpot/Twig-extensions.git
[metadata]
    git=http://github.com/schmittjoh/metadata.git
    version=1.0.0
[SensioFrameworkExtraBundle]
    git=http://github.com/sensio/SensioFrameworkExtraBundle.git
    target=/bundles/Sensio/Bundle/FrameworkExtraBundle
    version=origin/2.0
[JMSSecurityExtraBundle]
    git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
    target=/bundles/JMS/SecurityExtraBundle
    version=origin/1.0.x
[SensioDistributionBundle]
    git=http://github.com/sensio/SensioDistributionBundle.git
    target=/bundles/Sensio/Bundle/DistributionBundle
    version=origin/2.0
[SensioGeneratorBundle]
    git=http://github.com/sensio/SensioGeneratorBundle.git
    target=/bundles/Sensio/Bundle/GeneratorBundle
    version=origin/2.0
[AsseticBundle]
    git=http://github.com/symfony/AsseticBundle.git
    target=/bundles/Symfony/Bundle/AsseticBundle
    version=origin/2.0

[FOSUserBundle]
    git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
    target=bundles/FOS/UserBundle
    version=1.2.0
[FOSRest]
    git=git://github.com/FriendsOfSymfony/FOSRest.git
    target=fos/FOS/Rest
[FOSRestBundle]
    git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
    target=bundles/FOS/RestBundle
[JMSSerializerBundle]
    git=git://github.com/schmittjoh/JMSSerializerBundle.git
    target=bundles/JMS/SerializerBundle

[doctrine-mongodb]
    git=http://github.com/doctrine/mongodb.git
[doctrine-mongodb-odm]
    git=http://github.com/doctrine/mongodb-odm.git
[DoctrineMongoDBBundle]
    git=http://github.com/doctrine/DoctrineMongoDBBundle.git
    target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
    version=origin/2.0

我也没有在映射下看到驱动程序文件夹。我已经完成了php-bin/vendors的安装--重新安装bu,即使这样也无济于事。

您必须更新三个:DBAL、Common和ORM。三人已同时获释。因此,您应该对3使用2.2版本。

这是博客文章http://www.doctrine-project.org/blog/doctrine-2-2-final.html

希望这对我有帮助,它对我有用。

Doctrine MongoDB ODM最近进行了重构,以利用Doctrine Common的映射API,该映射存在于2.2+版本中(见PR的#350和#370)。反过来,捆绑包的2.0分支和主分支都被更新(PR#124)。

根据deps文件,您使用的是Doctrine Common 2.1.x,它不包含所需的类。您可以将Common提升到2.2,它应该与Symfony 2.0兼容,或者在合并这些PR之前将ODM和捆绑包锁定到早期的提交哈希。检查每个存储库中的composer.json文件是跟踪这些依赖关系的好方法,即使您没有使用Composer。希望我们很快就能在Mongo ODM存储库上有标签,这将在未来缓解这种头痛。

您要么没有安装Doctrine Common,要么没有在自动加载器中注册它。安装它(链接:https://github.com/doctrine/common)或者重新下载sf2标准版。