我按照以下说明逐步操作: 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 install --reinstall bu,即使这没有帮助。