Skip to content

Entity Manager

Mitchell van Wijngaarden edited this page May 10, 2014 · 4 revisions

The Entity Manager can accessed in multiple ways. One option is by using the EntityManager facade (or service locator). Other ways are by using the IoC container or constructor injection.

EntityManager::flush();
<?php

$entityManager = App::make('Doctrine\ORM\EntityManagerInterface');
<?php

use Doctrine\ORM\EntityManagerInterface

class ExampleController extends Controller
{
    private $entityManager;

    public function __construct(EntityManagerInterface $entityManager)
    {
        $this->entityManager = $entityManager;
    }
}
Clone this wiki locally