当前位置: 首页>>代码示例>>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;未经允许,请勿转载。