![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/laminas/laminas-db/src/TableGateway/Feature/ |
<?php namespace Laminas\Db\TableGateway\Feature; use Laminas\Db\Adapter\Adapter; use Laminas\Db\TableGateway\Exception; class GlobalAdapterFeature extends AbstractFeature { /** @var Adapter[] */ protected static $staticAdapters = []; /** * Set static adapter */ public static function setStaticAdapter(Adapter $adapter) { $class = static::class; static::$staticAdapters[$class] = $adapter; if ($class === self::class) { static::$staticAdapters[self::class] = $adapter; } } /** * Get static adapter * * @throws Exception\RuntimeException * @return Adapter */ public static function getStaticAdapter() { $class = static::class; // class specific adapter if (isset(static::$staticAdapters[$class])) { return static::$staticAdapters[$class]; } // default adapter if (isset(static::$staticAdapters[self::class])) { return static::$staticAdapters[self::class]; } throw new Exception\RuntimeException('No database adapter was found in the static registry.'); } /** * after initialization, retrieve the original adapter as "master" */ public function preInitialize() { $this->tableGateway->adapter = self::getStaticAdapter(); } }