public function create($userId, $domainPrefix, $accessToken, $tokenType, $expires, $refreshToken) { $query = ' INSERT INTO store (user_id, domain_prefix, access_token, token_type, expires, refresh_token, created_at) VALUES (:userId, :domainPrefix, :accessToken, :tokenType, :expires, :refreshToken, NOW()) '; $params = ['userId' => $userId, 'domainPrefix' => $domainPrefix, 'accessToken' => $accessToken, 'tokenType' => $tokenType, 'expires' => $expires, 'refreshToken' => $refreshToken]; DbFactory::getConnection('vend', DbFactory::TYPE_READ_WRITE)->query($query, $params); }
public function getByUserName($username) { $query = ' SELECT id, username, password, email FROM user WHERE username = :username '; $params = ['username' => $username]; return DbFactory::getConnection('vend', DbFactory::TYPE_READ_ONLY)->query($query, $params)->fetch(); }
/** * Tests if the factory produces an error on trying to create a connection to an invalid backend. */ public function testBadConnectionBackendType() { $this->setExpectedException('\\YapepBase\\Exception\\DatabaseException', 'Invalid database config'); $this->config->set(array('resource.database.test2.rw.backendType' => 'invalid')); DbFactory::getConnection('test2', DbFactory::TYPE_READ_WRITE); }