Doctrine\DBAL\Connection::setFetchMode PHP Method

setFetchMode() public method

Sets the fetch mode.
public setFetchMode ( integer $fetchMode ) : void
$fetchMode integer
return void
    public function setFetchMode($fetchMode)
    {
        $this->defaultFetchMode = $fetchMode;
    }

Usage Example

Esempio n. 1
0
 /**
  * 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);
 }
All Usage Examples Of Doctrine\DBAL\Connection::setFetchMode