Doctrine 2 with Symfony DI Container

后端 未结 2 1012
长发绾君心
长发绾君心 2021-01-15 17:25

I am working on a Zend Framework project that leverages Doctrine 2. I\'m trying to get Symfony\'s DI container working with the project as well, but I\'m having trouble. Sup

2条回答
  •  借酒劲吻你
    2021-01-15 17:48

    A Doctrine Entity is a newable, not an injectable. Entities are not supposed to be created through a DIC. See this following blog post on the difference between newable and injectable:

    http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/

提交回复
热议问题