daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Jan 20th, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. doctrine:
  2.     dbal:
  3.         default_connection: default
  4.         connections:
  5.             default:
  6.                 driver:   pdo_mysql
  7.                 host:     '%database_host%'
  8.                 port:     '%database_port%'
  9.                 dbname:   '%database_name%'
  10.                 user:     '%database_user%'
  11.                 password: '%database_password%'
  12.                 charset:  UTF8
  13.             customer:
  14.                 driver:   pdo_mysql
  15.                 host:     '%database_host2%'
  16.                 port:     '%database_port2%'
  17.                 dbname:   '%database_name2%'
  18.                 user:     '%database_user2%'
  19.                 password: '%database_password2%'
  20.                 charset:  UTF8
  21.     orm:
  22.         default_entity_manager: default
  23.         entity_managers:
  24.             default:
  25.                 connection: default
  26.                 mappings:
  27.                     AppBundle:  ~
  28.                     AcmeStoreBundle: ~
  29.             customer:
  30.                 connection: customer
  31.                 mappings:
  32.                     AcmeCustomerBundle: ~
  33.    
  34. class UserController extends Controller
  35. {
  36.     public function indexAction()
  37.     {
  38.         // All three return the "default" entity manager
  39.         $em = $this->get('doctrine')->getManager();
  40.         $em = $this->get('doctrine')->getManager('default');
  41.         $em = $this->get('doctrine.orm.default_entity_manager');
  42.         // Both of these return the "customer" entity manager
  43.         $customerEm = $this->get('doctrine')->getManager('customer');
  44.         $customerEm = $this->get('doctrine.orm.customer_entity_manager');
  45.     }
  46. }
  47.    
  48. /** @var EntityManager $em */
  49. $em = $this->getDoctrine()->getManager();
  50. $conn = $em->getConnection();
  51. $users = $conn->fetchAll('SELECT * FROM users');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top