Symfony2 projet在JSMserializerbundle和DoctrineMongoDBBundle中不起作用

时间:2012-05-06 04:38:43

标签: php symfony doctrine

我的symfony2 projet在开发环境中完美运行。切换到生产环境时会出现问题。当我调用一个具有实体数组的控制器并使用JSMserializer将其序列化为json时,它会崩溃。客户端仍然收到响应,但json为空,甚至不是“[]”。当我查看日志时,我可以阅读这些错误:

    security.INFO: Populated SecurityContext with an anonymous Token [] []
    request.INFO: Matched route "employe_index" (parameters: "_controller": "Pisteur\WebRefugeManager\Bundle\CoreBundle\Controller\EmployeController::indexAction", "_route": "employe_index") [] []
    request.CRITICAL: Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@proxy" in method Doctrine\MongoDB\Cursor::current() was never imported. Did you maybe forget to add a "use" statement for this annotation? (uncaught exception) at /home/wpdemo/symfony/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationException.php line 52 [] []

我搜索了谷歌中的错误,我发现了这两个主题:

https://github.com/doctrine/mongodb-odm/issues/255 https://github.com/schmittjoh/JMSSerializerBundle/issues/51

这些主题对我没有帮助,我真的不明白这个问题。有人有想法吗?

[编辑] 这是我的配置:

DEV:

imports:
    - { resource: config.yml }

framework:
    router:   { resource: "%kernel.root_dir%/config/routing_dev.yml" }
    profiler: { only_exceptions: false }

web_profiler:
    toolbar: true
    intercept_redirects: false

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        firephp:
            type:  firephp
            level: info

assetic:
    use_controller: true

PROD:

imports:
    - { resource: config.yml }

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested
        nested:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug

[编辑]

这是我运行的命令:

php app/console cache:clear --env=prod --no-debug
php app/console cache:warmup
php app/console assets:install web
php app/console assetic:dump web --env=prod --no-debug

1 个答案:

答案 0 :(得分:0)

有一次类似的问题,第一次使用Capifony进行部署时。我只能通过手动清除app / cache / prod文件夹来解决它。不使用缓存:清除,但实际上删除了文件夹,

rm -rf app/cache/prod

我还没有找出为什么cache:clear --env=prod有时候不能正确清除它,这可能是一个许可问题。