dss89001 2014-06-26 08:34
浏览 70

Symfony2 / Doctrine2.4“需要指定元数据驱动程序”

I want to use some of the features of Doctrine 2.4 (mainly named entity listeners) and $event->properyHasChanged('property') and updated my composer.json to this collection:

 "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4",
        "doctrine/orm": "2.4.3",
        "doctrine/doctrine-bundle": "~1.3",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~2.3",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0",
        "stof/doctrine-extensions-bundle": "dev-master",
        "friendsofsymfony/jsrouting-bundle": "~1.1",
        "friendsofsymfony/rest-bundle": "dev-master",
        "sprain/validator-bundle": "dev-master",
        "willdurand/geocoder-bundle": "@stable",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "escapestudios/wsse-authentication-bundle": "2.3.x-dev",
        "jms/serializer-bundle": "dev-master",
        "doctrine/doctrine-fixtures-bundle": "2.2.*",
        "luxifer/doctrine-functions": "dev-master"

    },

The composer.phar updates without problems until the end. After updating or when I try to use any console method (or the symfony2 app) I'm getting this error:

 [Doctrine\ORM\ORMException]                                                                                          
  It's a requirement to specify a Metadata Driver and pass it to Doctrine\ORM\Configuration::setMetadataDriverImpl().  

My Doctrine configuration is as follows:

doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        entity_managers:
            default:
                auto_mapping: true

Rolling back to doctrine 2.2 works. Is there a good example of symfony2 and Doctrine 2.4? Because even in the current version (2.6 of Symfony2 they are using an older version of Doctrine.

Any help is appreciated!

  • 写回答

1条回答 默认 最新

  • doulai8405 2014-06-26 08:44
    关注

    The default configuration as stated in the Doctrine Bundle docs is as follows:

    doctrine:
      orm:
        auto_mapping: true
        # the standard distribution overrides this to be true in debug, false otherwise
        auto_generate_proxy_classes: false
        proxy_namespace: Proxies
        proxy_dir: %kernel.cache_dir%/doctrine/orm/Proxies
        default_entity_manager: default
        metadata_cache_driver: array
        query_cache_driver: array
        result_cache_driver: array
    

    As you can see it adds a Metadata Driver of type array.

    Try and see if this solves your problem.

    评论

报告相同问题?

悬赏问题

  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离