我需要调用关闭连接吗?
在应用程序中,我多次使用Doctrine_Query::create()
。
每次使用都需要调用close连接吗?或者教义会为我做这件事吗?
In the application I use Doctrine_Query::create()
many times.
Do I need to call close connection each time I use it? Or will doctrine do it for me ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建查询不会创建新连接,因此您完全不必担心。 Doctrine 连接管理器会为每个请求建立一个连接,并且您的所有查询都将通过该连接进行。
Creating a query does not make a new connection, so you don't need to worry at all. There is a single connection established each request by the Doctrine connection manager, and all your queries will go over that connection.
每个查询都共享相同的连接。无需关闭它。
您可以检查
Doctrine_Manager
以了解这是如何完成的。Each query is sharing the same connection. There is no need to close it.
You can examine
Doctrine_Manager
to see how this is done.