Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?
  2. // bootstrap.php
  3.  
  4. /**
  5.  * Bootstrap Doctrine.php, register autoloader specify
  6.  * configuration attributes and load models.
  7.  */
  8.  
  9. require_once(dirname(__FILE__) . '/lib/vendor/doctrine/Doctrine.php');
  10. spl_autoload_register(array('Doctrine', 'autoload'));
  11. spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
  12.  
  13. $manager = Doctrine_Manager::getInstance();
  14.  
  15. $dsn = 'mysql:dbname=ecommerce;host=localhost';
  16. $user = 'root';
  17. $password = '*****';
  18.  
  19. $dbh = new PDO($dsn, $user, $password);
  20. $conn = Doctrine_Manager::connection($dbh);
  21.  
  22. $manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
  23. $manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL);
  24.  
  25. $manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
  26.  
  27. Doctrine_Core::loadModels('models');
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement