当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::__construct方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Connection::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::__construct方法的具体用法?PHP Connection::__construct怎么用?PHP Connection::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  *
  * @param array                              $params
  * @param \Doctrine\DBAL\Driver              $driver
  * @param \Doctrine\DBAL\Configuration|null  $config
  * @param \Doctrine\Common\EventManager|null $eventManager
  */
 public function __construct(array $params, $driver, $config = null, $eventManager = null)
 {
     $this->_platformMock = new DatabasePlatformMock();
     parent::__construct($params, $driver, $config, $eventManager);
     // Override possible assignment of platform to database platform mock
     $this->_platform = $this->_platformMock;
 }
开发者ID:DAICAR,项目名称:ZfcDatagrid,代码行数:14,代码来源:ConnectionMock.php

示例2: __construct

 /**
  * @param array $params
  * @param Driver|ServerGoneAwayExceptionsAwareInterface $driver
  * @param Configuration $config
  * @param EventManager $eventManager
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if ($driver instanceof ServerGoneAwayExceptionsAwareInterface && isset($params['driverOptions']['x_reconnect_attempts'])) {
         $this->reconnectAttempts = (int) $params['driverOptions']['x_reconnect_attempts'];
     }
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:NickelMedia,项目名称:doctrine-mysql-come-back,代码行数:13,代码来源:Connection.php

示例3: __construct

 /**
  * @param array $params
  * @param Driver $driver
  * @param Configuration $config
  * @param EventManager $eventManager
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (isset($params['driverOptions']['x_reconnect_attempts']) && method_exists($driver, 'getReconnectExceptions')) {
         $reconnectExceptions = $driver->getReconnectExceptions();
         $this->reconnectAttempts = empty($reconnectExceptions) ? 0 : (int) $params['driverOptions']['x_reconnect_attempts'];
     }
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:akovalyov,项目名称:doctrine-mysql-come-back,代码行数:14,代码来源:Connection.php

示例4: __construct

 /**
  * Initializes a new instance of the Connection class.
  *
  * @param array         $params
  * @param Driver        $driver
  * @param Configuration $config
  * @param EventManager  $eventManager
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     parent::__construct($params, $driver, $config, $eventManager);
     if (isset($params['prefix'])) {
         $this->prefix = $params['prefix'];
     }
     $this->regex['quotes'] = "/([^'\"]+)(?:" . self::DOUBLE_QUOTED_TEXT . "|" . self::SINGLE_QUOTED_TEXT . ")?/As";
     $this->regex['placeholder'] = "/" . preg_quote($this->placeholder) . "([a-zA-Z_][a-zA-Z0-9_]*)/";
 }
开发者ID:jacobjjc,项目名称:PageKit-framework,代码行数:17,代码来源:ConnectionWrapper.php

示例5: __construct

 /**
  * @param array                                         $params
  * @param Driver|ServerGoneAwayExceptionsAwareInterface $driver
  * @param Configuration                                 $config
  * @param EventManager                                  $eventManager
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!$driver instanceof ServerGoneAwayExceptionsAwareInterface) {
         throw new \InvalidArgumentException(sprintf('%s needs a driver that implements ServerGoneAwayExceptionsAwareInterface', get_class($this)));
     }
     if (isset($params['driverOptions']['x_reconnect_attempts'])) {
         $this->reconnectAttempts = (int) $params['driverOptions']['x_reconnect_attempts'];
     }
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:facile-it,项目名称:doctrine-mysql-come-back,代码行数:18,代码来源:Connection.php

示例6: __construct

 /**
  * Initializes a new instance of the Connection class.
  *
  * @param array $params  The connection parameters.
  * @param \Doctrine\DBAL\Driver $driver
  * @param \Doctrine\DBAL\Configuration $config
  * @param \Doctrine\Common\EventManager $eventManager
  * @throws \Exception
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!isset($params['adapter'])) {
         throw new \Exception('adapter not set');
     }
     if (!isset($params['tablePrefix'])) {
         throw new \Exception('tablePrefix not set');
     }
     parent::__construct($params, $driver, $config, $eventManager);
     $this->adapter = new $params['adapter']($this);
     $this->tablePrefix = $params['tablePrefix'];
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:21,代码来源:connection.php

示例7: __construct

 /**
  * Initializes a new instance of the Connection class.
  *
  * @param array         $params
  * @param Driver        $driver
  * @param Configuration $config
  * @param EventManager  $eventManager
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!isset($params['defaultTableOptions'])) {
         $params['defaultTableOptions'] = [];
     }
     foreach (['engine', 'charset', 'collate'] as $name) {
         if (isset($params[$name])) {
             $params['defaultTableOptions'][$name] = $params[$name];
             unset($params[$name]);
         }
     }
     if (isset($params['prefix'])) {
         $this->prefix = $params['prefix'];
     }
     $this->regex = ['quotes' => "/([^'\"]+)(?:" . self::DOUBLE_QUOTED_TEXT . "|" . self::SINGLE_QUOTED_TEXT . ")?/As", 'placeholder' => "/" . preg_quote($this->placeholder) . "([a-zA-Z_][a-zA-Z0-9_]*)/"];
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:25,代码来源:Connection.php

示例8: __construct

 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     $this->failoverStatus = new FailoverStatus($params);
     $this->heartbeat = new TableHeartbeat($params);
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:kirillsablin,项目名称:doctrine-failover,代码行数:6,代码来源:MasterMasterFailoverConnection.php

示例9: __construct

 /**
  * @param array                         $params
  * @param \Doctrine\DBAL\Driver         $driver
  * @param \Doctrine\DBAL\Configuration  $config
  * @param \Doctrine\Common\EventManager $eventManager
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!isset($params['global']) || !isset($params['shards'])) {
         throw new \InvalidArgumentException("Connection Parameters require 'global' and 'shards' configurations.");
     }
     if (!isset($params['shardChoser'])) {
         throw new \InvalidArgumentException("Missing Shard Choser configuration 'shardChoser'");
     }
     if (is_string($params['shardChoser'])) {
         $params['shardChoser'] = new $params['shardChoser']();
     }
     if (!$params['shardChoser'] instanceof ShardChoser) {
         throw new \InvalidArgumentException("The 'shardChoser' configuration is not a valid instance of Doctrine\\DBAL\\Sharding\\ShardChoser\\ShardChoser");
     }
     $this->connections[0] = array_merge($params, $params['global']);
     foreach ($params['shards'] as $shard) {
         if (!isset($shard['id'])) {
             throw new \InvalidArgumentException("Missing 'id' for one configured shard. Please specify a unique shard-id.");
         }
         if (!is_numeric($shard['id']) || $shard['id'] < 1) {
             throw new \InvalidArgumentException("Shard Id has to be a non-negative number.");
         }
         if (isset($this->connections[$shard['id']])) {
             throw new \InvalidArgumentException("Shard " . $shard['id'] . " is duplicated in the configuration.");
         }
         $this->connections[$shard['id']] = array_merge($params, $shard);
     }
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:cuppyzh,项目名称:go_laundry,代码行数:37,代码来源:PoolingShardConnection.php

示例10: __construct

 public function __construct(array $params, $driver, $config = null, $eventManager = null)
 {
     parent::__construct($params, $driver, $config, $eventManager);
     $this->_platformMock = new DatabasePlatformMock();
     $this->_platform = $this->_platformMock;
 }
开发者ID:jackbravo,项目名称:doctrine,代码行数:6,代码来源:ConnectionMock.php

示例11: __construct

 public function __construct(array $params, Driver $driver, $config, $eventManager)
 {
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:phpthinktank,项目名称:blast-orm,代码行数:4,代码来源:Connection.php

示例12: connectToDatabase

 private function connectToDatabase(Connection $db, $databaseName)
 {
     $db->close();
     $db->__construct(['dbname' => $databaseName] + $db->getParams(), $db->getDriver(), $db->getConfiguration(), $db->getEventManager());
     $db->connect();
 }
开发者ID:jiripudil,项目名称:blog-db-testing,代码行数:6,代码来源:DatabaseSetup.php

示例13: __construct

 public function __construct($connection)
 {
     return parent::__construct($connection->getParams(), $connection->getDriver(), $connection->getConfiguration(), $connection->getEventManager());
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:4,代码来源:TestCaseConnection.php

示例14: __construct

 /**
  * Initializes a new instance of the Connection class.
  *
  * This sets up necessary variables before calling parent constructor
  *
  * @param array         $params       Parameters for the driver
  * @param Driver        $driver       The driver to use
  * @param Configuration $config       The connection configuration
  * @param EventManager  $eventManager Event manager to use
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!defined('XOOPS_DB_PROXY') || $_SERVER['REQUEST_METHOD'] !== 'GET' || php_sapi_name() === 'cli') {
         self::setSafe(true);
     } else {
         self::setSafe(false);
     }
     self::setForce(false);
     self::$transactionActive = false;
     try {
         parent::__construct($params, $driver, $config, $eventManager);
     } catch (\Exception $e) {
         // We are dead in the water. This exception may contain very sensitive
         // information and cannot be allowed to be displayed as is.
         //$xoopsPreload->triggerEvent('core.exception', $e);
         trigger_error("Cannot get database connection", E_USER_ERROR);
     }
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:28,代码来源:Connection.php

示例15: __construct

 /**
  * Creates Master Slave Connection.
  *
  * @param array                              $params
  * @param \Doctrine\DBAL\Driver              $driver
  * @param \Doctrine\DBAL\Configuration|null  $config
  * @param \Doctrine\Common\EventManager|null $eventManager
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     if (!isset($params['slaves']) || !isset($params['master'])) {
         throw new \InvalidArgumentException('master or slaves configuration missing');
     }
     if (count($params['slaves']) == 0) {
         throw new \InvalidArgumentException('You have to configure at least one slaves.');
     }
     $params['master']['driver'] = $params['driver'];
     foreach ($params['slaves'] as $slaveKey => $slave) {
         $params['slaves'][$slaveKey]['driver'] = $params['driver'];
     }
     $this->keepSlave = isset($params['keepSlave']) ? (bool) $params['keepSlave'] : false;
     parent::__construct($params, $driver, $config, $eventManager);
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:25,代码来源:MasterSlaveConnection.php


注:本文中的Doctrine\DBAL\Connection::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。