Guest User

Untitled

a guest
Nov 17th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public function myManager(){
  2. $isDevMode = true;
  3. $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/AppBundle/Entity"), $isDevMode);
  4.  
  5. // database configuration parameters
  6. $conn = array(
  7. 'dbname' => 'teste',
  8. 'user' => 'root',
  9. 'password' => '',
  10. 'host' => '127.0.0.1',
  11. 'driver' => 'pdo_mysql',
  12. );
  13.  
  14. $entityManager = EntityManager::create($conn, $config);
  15. return $entityManager;
  16. }
  17.  
  18. public function testAction(){
  19. $em = $this->myManager()->getRepository('Product');
  20. return $this->render('toto.html.twig');
  21. }
Add Comment
Please, Sign In to add comment