Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Config
- {
- static $dbHost = 'localhost';
- static $dbName = 'name';
- static $dbUser = 'user';
- static $dbPass = 'pass';
- }
- $this->configService('db', function (ServiceLocator $context) {
- return new PDO(
- 'mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName . ';charset=utf8',
- Config::$dbUser,
- Config::$dbPass
- );
- });
- $this->configService('db', function (ServiceLocator $context) {
- $password = Config::$dbPass;
- Config::$dbPass = '';
- return new PDO(
- 'mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName . ';charset=utf8',
- Config::$dbUser,
- $password
- );
- });
Add Comment
Please, Sign In to add comment