예제 #1
0
 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);
 }
예제 #2
0
 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();
 }
예제 #3
0
 /**
  * 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);
 }