Import doctrine orm in controller class


#1

How to import doctrine orm object in Slim’s controller class? Any sample please?


#2

You could use the container object to fetch the doctrine object (not recommended because it’s an anti-pattern) or better use PHP-DI to inject the required services.

http://php-di.org/doc/frameworks/slim.html
http://php-di.org/doc/autowiring.html