當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::setFetchMode方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Connection::setFetchMode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::setFetchMode方法的具體用法?PHP Connection::setFetchMode怎麽用?PHP Connection::setFetchMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::setFetchMode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setupConfigurationDbal

 /**
  * setup configuration for Doctrine Dbal.
  * 
  * @param array $db_config array config for override the default configuration.
  */
 public function setupConfigurationDbal(array $db_config = [])
 {
     $dbal_config = new Configuration();
     if (empty($db_config)) {
         //setup connection configuration.
         $config = new SystemConfig();
         $config->load('db');
         $db_params = $config->get('ALL', 'db');
         unset($config, $db_params['table_prefix']);
     } else {
         $db_params = $db_config;
         unset($db_params['table_prefix']);
     }
     $dbal_config->setSQLLogger(new \System\Libraries\Db\Logger());
     try {
         $this->Conn = DriverManager::getConnection($db_params, $dbal_config);
         $this->Conn->connect();
     } catch (\Doctrine\DBAL\DBALException $e) {
         http_response_code(500);
         echo $e->getMessage();
         exit;
     }
     $this->Conn->setFetchMode(\PDO::FETCH_OBJ);
     unset($dbal_config, $db_params);
 }
開發者ID:AgniCMS,項目名稱:agni-framework,代碼行數:30,代碼來源:Bootstrap.php

示例2: connect

 public function connect()
 {
     if ($this->connection === null) {
         $connection_params = array('dbname' => config()->db_name(), 'user' => config()->db_user(), 'password' => config()->db_pass(), 'host' => config()->db_host(), 'driver' => 'pdo_mysql');
         $this->connection = \Doctrine\DBAL\DriverManager::getConnection($connection_params, new \Doctrine\DBAL\Configuration());
         $this->connection->setFetchMode(\PDO::FETCH_OBJ);
     }
 }
開發者ID:moxi9,項目名稱:unity,代碼行數:8,代碼來源:Db.php

示例3: __construct

 /**
  * Contructor
  *
  * @var string $dsn          The connection string
  * @var string $tablePrefix  Table prefix
  */
 public function __construct($dsn, $tablePrefix = null)
 {
     $this->con = \Doctrine\DBAL\DriverManager::getConnection(array('url' => $dsn));
     $this->con->setFetchMode(\PDO::FETCH_ASSOC);
     if (!empty($tablePrefix)) {
         foreach ($this->tables as $tableName) {
             $this->tables[$tableName] = rtrim($tablePrefix, '_') . '_' . $tableName;
         }
     }
 }
開發者ID:albancrommer,項目名稱:acmephpc,代碼行數:16,代碼來源:DoctrineDbal.php

示例4: __construct

 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     $this->connection->setFetchMode(\PDO::FETCH_OBJ);
 }
開發者ID:renereed1,項目名稱:proophessor-do,代碼行數:5,代碼來源:UserFinder.php


注:本文中的Doctrine\DBAL\Connection::setFetchMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。