Doctrine中的mysql_close()替代方案

I have a rather long script, and I have noticed that I have too many dormant MySQL connections. I'd rather have them close before the script finishes running.

I was wondering what is the Doctrine way of closing connections? Something like mysql_close() in plain PHP.

Get a reference to your entity manager and then simply do this:

$entityManager->getConnection()->close();

look in the documentation of doctrine about connections here