Skip to content

Entity Manager

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

One option is by using the EntityManager facade (or service locator). Other ways are by using the IoC container or constructor injection.

EntityManager::flush();
$entityManager = App::make('Doctrine\ORM\EntityManagerInterface');
use Doctrine\ORM\EntityManagerInterface

class ExampleController extends Controller
{
    private $entityManager;

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