Last active
January 15, 2016 17:44
-
-
Save licvido/4d6e78967f47b37a996a to your computer and use it in GitHub Desktop.
NETTE: Database connection sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'nette.phar'; | |
Tracy\Debugger::enable(); | |
$dsn = "mysql:host=localhost;dbname=database"; | |
$user = "root"; | |
$password = "***"; | |
$connection = new Nette\Database\Connection($dsn, $user, $password); | |
$cacheStorage = new Nette\Caching\Storages\MemoryStorage; | |
$structure = new Nette\Database\Structure($connection, $cacheStorage); | |
$conventions = new Nette\Database\Conventions\DiscoveredConventions($structure); | |
$context = new Nette\Database\Context($connection, $structure, $conventions, $cacheStorage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment