当前位置: 首页>>代码示例>>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;未经允许,请勿转载。