Skip to content

Instantly share code, notes, and snippets.

@shahroznawaz
Created January 22, 2018 08:53
Show Gist options
  • Save shahroznawaz/6a3cbb2b4d472242638f7b22e6281553 to your computer and use it in GitHub Desktop.
Save shahroznawaz/6a3cbb2b4d472242638f7b22e6281553 to your computer and use it in GitHub Desktop.
User Controller
class UserController extends Controller
{
public function indexAction()
{
// All 3 return the "default" entity manager
$em = $this->getDoctrine()->getManager();
$em = $this->getDoctrine()->getManager('default');
$em = $this->get('doctrine.orm.default_entity_manager');
// Both of these return the "database2" entity manager
$anotherEm = $this->getDoctrine()->getManager('database2');
$anotherEm = $this->get('doctrine.orm.database2_entity_manager');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment