當前位置: 首頁>>代碼示例>>PHP>>正文


PHP static::adapter方法代碼示例

本文整理匯總了PHP中static::adapter方法的典型用法代碼示例。如果您正苦於以下問題:PHP static::adapter方法的具體用法?PHP static::adapter怎麽用?PHP static::adapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在static的用法示例。


在下文中一共展示了static::adapter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAdapter

 /**
  * Get the database configuration adapter.
  *
  * @return ConfigAdapterInterface
  */
 public static function getAdapter()
 {
     if (null === static::$adapter) {
         static::$adapter = new Ini();
     }
     return static::$adapter;
 }
開發者ID:smrtr,項目名稱:mysql-version-control,代碼行數:12,代碼來源:DbConfig.php

示例2: select

 /**
  * Create and return instance of Select Statement for entity. If entity
  * has defined select, the return object will be this instance.
  *
  * @return Juborm\Select Statement of select
  */
 public static function select($columns = null)
 {
     if (is_string($columns)) {
         // zostala podana tylko jedna kolumna wiec zamieniam na arraya
         $columns = array($columns);
     }
     // wczytuje klase select
     $select = is_null(static::$select) ? ORMSelect::class : static::$select;
     $cleanEntity = new static();
     $select = $cleanEntity->adapter()->dml(MidataDML::SELECT);
     $select->from(static::$table)->entity(static::class)->model($cleanEntity->model())->source($cleanEntity->source());
     if (is_null($columns)) {
         $columns = static::fields();
     }
     // columns of primary key are added to each entity
     $pks = static::pkDefinition();
     foreach ($pks as $pk) {
         if (!in_array($pk, $columns)) {
             $columns[] = $pk;
         }
     }
     foreach ($columns as $alias => $value) {
         if (is_int($alias)) {
             $select->column($value);
         } else {
             $select->column($value, $alias);
         }
     }
     // the last step is prepare the select to use
     $select->prepare();
     // endtodo
     return $select;
 }
開發者ID:ttmdear,項目名稱:juborm,代碼行數:39,代碼來源:Entity.php

示例3: setAdapter

 /**
  * @param \Phramework\Database\IAdapter $adapter
  * @throws \Exception
  */
 public static function setAdapter(\Phramework\Database\IAdapter $adapter)
 {
     if (!$adapter instanceof \Phramework\Database\IAdapter) {
         throw new \Exception('Class is not implementing \\Phramework\\Database\\IAdapter');
     }
     static::$adapter = $adapter;
 }
開發者ID:phramework,項目名稱:database,代碼行數:11,代碼來源:Database.php

示例4: establish_connection

 /**
  * Required
  * connects to the data base and stores the connection
  * @param $db_settings_name Array
  */
 public static function establish_connection($db_settings_name)
 {
     $file = strtolower($db_settings_name['adapter']) . '_adapter';
     $class = "\\ActivePhp\\" . \Inflector::classify($file);
     $klass = new $class($db_settings_name);
     static::$adapter = $klass;
 }
開發者ID:scottdavis,項目名稱:active_php,代碼行數:12,代碼來源:base.php

示例5: setupBeforeClass

 /**
  * Initialize router
  */
 static function setupBeforeClass()
 {
     parent::setupBeforeClass();
     if (testAdapter == 'HTTP') {
         // echo("Test using HTTP adapter\n");
         static::$adapter = new GuzzleAdapter(new Client());
     } else {
         if (null == self::$app) {
             // echo("Test using built-in Router\n");
             self::$app = new Router();
         }
     }
 }
開發者ID:dervomsee,項目名稱:volkszaehler.org,代碼行數:16,代碼來源:Middleware.php

示例6: initialize

 /**
  * Initializes the cache.
  *
  * With the $options array it's possible to define:
  * - expiration of the key, (time in seconds)
  * - a namespace for the key
  *
  * this last one is useful in the case two applications use
  * a shared key/store (for instance a shared Memcached db)
  *
  * Ex:
  * $cfg_ar = ActiveRecord\Config::instance();
  * $cfg_ar->set_cache('memcache://localhost:11211',array('namespace' => 'my_cool_app',
  *																											 'expire'		 => 120
  *																											 ));
  *
  * In the example above all the keys expire after 120 seconds, and the
  * all get a postfix 'my_cool_app'.
  *
  * (Note: expiring needs to be implemented in your cache store.)
  *
  * @param string $url URL to your cache server
  * @param array $options Specify additional options
  */
 public static function initialize($url, $options = array())
 {
     if ($url) {
         $url = parse_url($url);
         $file = ucwords(Inflector::instance()->camelize($url['scheme']));
         $class = "ActiveRecord\\{$file}";
         require_once __DIR__ . "/cache/{$file}.php";
         static::$adapter = new $class($url);
     } else {
         static::$adapter = null;
     }
     static::$options = array_merge(array('expire' => 30, 'namespace' => ''), $options);
 }
開發者ID:imranweb7,項目名稱:msitc-erp,代碼行數:37,代碼來源:cache.php

示例7: init

 /**
  * Initialization
  */
 public function init()
 {
     parent::init();
     if (empty($this->config['db'])) {
         $message = 'Incorrect param `db`!';
         \Yii::error(PHP_EOL . $message, __METHOD__ . '(' . __LINE__ . ')');
         throw new InvalidParamException($message);
     }
     $params = ['class' => __NAMESPACE__ . '\\db\\Connection', 'params' => $this->config['db']];
     static::$adapter = \Yii::createObject($params);
     if (isset($this->config['max-count']) && (int) $this->config['max-count']) {
         $this->maxPostCount = (int) $this->config['max-count'];
     }
 }
開發者ID:phantom-d,項目名稱:yii2-file-daemon,代碼行數:17,代碼來源:FileProcessing.php

示例8: register

 public static function register(Di $di)
 {
     static::$di = $di;
     $di->remove('counter');
     static::$adapter = null;
     $di->setShared('counter', function () {
         $default = Config::get('counter.default');
         $config = Config::get('counter.drivers.' . $default);
         $class = $config['adapter'];
         $options = $config['options'];
         strpos($class, '\\') === false and $class = 'Phwoolcon\\Util\\Counter\\' . $class;
         return new $class($options);
     });
 }
開發者ID:phwoolcon,項目名稱:phwoolcon,代碼行數:14,代碼來源:Counter.php

示例9: create

 /**
  * Create Session Adapter instance using Factory pattern
  *
  * @param string $adapterName
  * @param string $name
  * @return SessionAdapterInterface
  * @throws Exception
  */
 public static function create($adapterName, $name = '')
 {
     if (!in_array($adapterName, static::$allowedAdapters)) {
         throw new Exception(null, $adapterName . ' is not allowed as Session adapter');
     }
     $adapterName = ucfirst($adapterName);
     switch ($adapterName) {
         case static::SESSION:
             static::$adapter = new Session($name);
             break;
         default:
             throw new Exception(null, $adapterName . ' is not implemented as Session adapter');
             break;
     }
     return static::$adapter;
 }
開發者ID:cipherpols,項目名稱:cze,代碼行數:24,代碼來源:Factory.php

示例10: load_adapter

 public static function load_adapter($db_settings)
 {
     if ($db_settings["dbtype"] == "none") {
         return true;
     }
     $adapter = "Wax" . ucfirst($db_settings["dbtype"]) . "Adapter";
     static::$adapter = $adapter;
     static::$db_settings = $db_settings;
 }
開發者ID:phpwax,項目名稱:waxmodel,代碼行數:9,代碼來源:WaxModel.php

示例11: setAdapter

 public static function setAdapter(adapter $adapter)
 {
     static::$adapter = $adapter;
 }
開發者ID:atoum,項目名稱:atoum,代碼行數:4,代碼來源:stream.php

示例12: setAdapter

 public static function setAdapter(atoum\test\adapter $adapter = null)
 {
     static::$adapter = $adapter ?: new atoum\php\mocker\adapter();
 }
開發者ID:andrewolobo,項目名稱:mpTracker,代碼行數:4,代碼來源:mocker.php

示例13: changeCacheAdapter

 public static function changeCacheAdapter($adapter)
 {
     static::$adapter = $adapter;
 }
開發者ID:riteshkmr33,項目名稱:ovessnce,代碼行數:4,代碼來源:DataCache.php

示例14: configureFacadeWithToolbox

 /**
  * Configures the facade, want to have a new Writer? A new Object Database or a new
  * Adapter and you want it on-the-fly? Use this method to hot-swap your facade with a new
  * toolbox.
  *
  * @param RedBean_ToolBox $tb toolbox
  *
  * @return RedBean_ToolBox $tb old, rusty, previously used toolbox
  */
 public static function configureFacadeWithToolbox(RedBean_ToolBox $tb)
 {
     $oldTools = static::$toolbox;
     static::$toolbox = $tb;
     static::$writer = static::$toolbox->getWriter();
     static::$adapter = static::$toolbox->getDatabaseAdapter();
     static::$redbean = static::$toolbox->getRedBean();
     static::$associationManager = new RedBean_AssociationManager(static::$toolbox);
     static::$redbean->setAssociationManager(static::$associationManager);
     static::$extAssocManager = new RedBean_ExtAssociationManager(static::$toolbox);
     $helper = new RedBean_ModelHelper();
     static::$redbean->addEventListener('update', $helper);
     static::$redbean->addEventListener('open', $helper);
     static::$redbean->addEventListener('delete', $helper);
     static::$associationManager->addEventListener('delete', $helper);
     static::$redbean->addEventListener('after_delete', $helper);
     static::$redbean->addEventListener('after_update', $helper);
     static::$redbean->addEventListener('dispense', $helper);
     static::$tagManager = new RedBean_TagManager(static::$toolbox);
     static::$f = new RedBean_SQLHelper(static::$adapter);
     return $oldTools;
 }
開發者ID:spiogit,項目名稱:cna-seed-project,代碼行數:31,代碼來源:rb.php

示例15: establish_connection

 /**
  * Required
  * connects to the database and stores the connection
  * @param array $db_settings
  */
 public static function establish_connection(array $db_settings)
 {
     static::$database = $db_settings['database'];
     $file = strtolower($db_settings['adapter']) . '_adapter';
     $filename = $file . '.php';
     /**
      * lazy loading of the adapter
      */
     $_adapters = self::get_available_adapters();
     if (isset($_adapters[$filename])) {
         require_once __DIR__ . '/../adapters/' . $filename;
     }
     $class = Inflector::classify($file);
     $klass = new $class($db_settings);
     static::load_interfaces();
     static::$adapter = $klass;
 }
開發者ID:scottdavis,項目名稱:nimblize,代碼行數:22,代碼來源:nimble_record.php


注:本文中的static::adapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。