本文整理汇总了PHP中Zend\Db\Adapter\Adapter::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Adapter::__construct方法的具体用法?PHP Adapter::__construct怎么用?PHP Adapter::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\Adapter
的用法示例。
在下文中一共展示了Adapter::__construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @throws \BLW\Model\InvalidArgumentException If an invalid argument is passed.
*
* @param \PDO $Connection
* PDO Object already connected to DB.
* @param \Zend\Db\Adapter\Platform\PlatformInterface $platform
* [optional] Adaptor Platform (Mysql, Oracle, Postgre, Sqlite, etc).
* @param \Zend\Db\ResultSet\ResultSetInterface $queryResultPrototype
* [optional] Result set class. <code>NULL</code> for default.
* @param \Zend\Db\Adapter\Profiler\ProfilerInterface $profiler
* [optional] Adapter profiler.
*/
public function __construct(\PDO $Connection, PlatformInterface $platform = null, ResultSetInterface $queryResultPrototype = null, ProfilerInterface $profiler = null)
{
// Creat driver
$Driver = new Driver(new Connection($Connection));
// Call parent
try {
parent::__construct($Driver, $platform, $queryResultPrototype, $profiler);
// Forward exception
} catch (\Zend\Db\Exception\InvalidArgumentException $e) {
// @codeCoverageIngoreStart
throw new InvalidArgumentException(-1, '%header% ' . $e->getMessage(), $e->getCode());
// @codeCoverageIngoreEnd
}
}
示例2: __construct
/**
* Constructor
*
* @throws \BLW\Model\InvalidArgumentException If an invalid argument is passed.
*
* @param resource $Connection
* PDO Object already connected to DB.
* @param \Zend\Db\Adapter\Platform\PlatformInterface $platform
* [optional] Adaptor Platform (Mysql, Oracle, Postgre, Sqlite, etc).
* @param \Zend\Db\ResultSet\ResultSetInterface $queryResultPrototype
* [optional] Result set class. <code>NULL</code> for default.
* @param \Zend\Db\Adapter\Profiler\ProfilerInterface $profiler
* [optional] Adapter profiler.
*/
public function __construct($Connection, PlatformInterface $platform = null, ResultSetInterface $queryResultPrototype = null, ProfilerInterface $profiler = null)
{
// Check connection
if (!is_resource($Connection) ?: strpos(get_resource_type($Connection), 'mysql') === false) {
// Exception
throw new InvalidArgumentException(0, '%header% Argument 1 should be a myqli connection');
} else {
// Create driver
$Driver = new Driver(new Connection($Connection));
// Call parent
try {
parent::__construct($Driver, $platform, $queryResultPrototype, $profiler);
// Invalid argument?
} catch (\Zend\Db\Exception\InvalidArgumentException $e) {
// Forward exception
throw new InvalidArgumentException(-1, '%header% ' . $e->getMessage(), $e->getCode());
}
}
}
示例3: __construct
/**
* @param Adapter $slaveAdapter
* @param Driver\DriverInterface|array $driver
* @param Platform\PlatformInterface $platform
* @param ResultSet\ResultSet $queryResultPrototype
*/
public function __construct(Adapter $slaveAdapter, $driver, Platform\PlatformInterface $platform = null, ResultSet\ResultSetInterface $queryResultPrototype = null)
{
$this->slaveAdapter = $slaveAdapter;
parent::__construct($driver, $platform, $queryResultPrototype);
}
示例4: __construct
public function __construct($driver)
{
parent::__construct($driver);
}
示例5: __construct
/**
* Connection constructor.
* @param array $config
*/
public function __construct(array $config)
{
$this->config = $config;
parent::__construct($config);
}