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


PHP static::collection方法代碼示例

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


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

示例1: distinctTags

 /**
  *
  * @param array $types
  * @return unknown
  */
 public static function distinctTags($query = array())
 {
     $model = new static();
     $distinct = $model->collection()->distinct("tags", $query);
     $distinct = array_values(array_filter((array) $distinct));
     return $distinct;
 }
開發者ID:dioscouri,項目名稱:f3-lib,代碼行數:12,代碼來源:Taggable.php

示例2: distinctPriorities

 /**
  *
  * @param array $types
  * @return unknown
  */
 public static function distinctPriorities($query = array())
 {
     $model = new static();
     $distinct = $model->collection()->distinct("priority", $query);
     $distinct = array_values(array_filter($distinct));
     sort($distinct);
     return $distinct;
 }
開發者ID:dioscouri,項目名稱:f3-lib,代碼行數:13,代碼來源:QueueArchives.php

示例3: collection

 /**
  * Get the Collection from the Repository.
  *
  * @param Repository $repository A specific Repository to get the Collection from.
  *
  * @return Collection The Collection from the Repository.
  */
 public static function collection(Repository $repository = null)
 {
     if (null === $repository) {
         $repository = Tacit::getInstance()->container->get('repository');
     }
     static::$collection = $repository->collection(static::collectionName());
     return static::$collection;
 }
開發者ID:vgrish,項目名稱:tacit,代碼行數:15,代碼來源:Persistent.php

示例4: fromCode

 public static function fromCode($isocode, $type = 'isocode_2')
 {
     $model = new static();
     if ($doc = $model->collection()->findOne(array($type => $isocode))) {
         $model = $model->bind($doc);
     }
     return $model;
 }
開發者ID:dioscouri,項目名稱:f3-shop,代碼行數:8,代碼來源:Countries.php

示例5: getCollection

 /**
  * Provides direct access to the collection of temporaries, if necessary.
  */
 public static function getCollection()
 {
     if (!static::$collection) {
         static::$collection = new Collection();
         register_shutdown_function(function () {
             static::complete();
         });
     }
     return static::$collection;
 }
開發者ID:zondor,項目名稱:Robo,代碼行數:13,代碼來源:Temporary.php

示例6: getCollection

 /**
  * Provides direct access to the collection of temporaries, if necessary.
  */
 public static function getCollection()
 {
     if (!static::$collection) {
         static::$collection = \Robo\Robo::getContainer()->get('collection');
         register_shutdown_function(function () {
             static::complete();
         });
     }
     return static::$collection;
 }
開發者ID:jjok,項目名稱:Robo,代碼行數:13,代碼來源:Temporary.php

示例7: forSelection

 /**
  * Helper method for creating select list options
  *
  * @param array $query
  * @return multitype:multitype:string NULL
  */
 public static function forSelection(array $query = array(), $id_field = '_id')
 {
     $model = new static();
     $cursor = $model->collection()->find($query, array("last_name" => 1, "first_name" => 1, "email" => 1));
     $cursor->sort(array("last_name" => 1, "first_name" => 1));
     $result = array();
     foreach ($cursor as $doc) {
         $array = array('id' => (string) $doc[$id_field], 'text' => htmlspecialchars(trim($doc['first_name'] . ' ' . $doc['last_name'] . ': ' . $doc['email']), ENT_QUOTES));
         $result[] = $array;
     }
     return $result;
 }
開發者ID:dioscouri,項目名稱:f3-shop,代碼行數:18,代碼來源:Customers.php

示例8: forSelection

 /**
  * Helper method for creating select list options
  *
  * @param array $query            
  * @return multitype:multitype:string NULL
  */
 public static function forSelection(array $query = array())
 {
     $model = new static();
     $cursor = $model->collection()->find($query, array($model->__select2_fields['text'] => 1));
     $cursor->sort(array($model->__select2_fields['text'] => 1));
     $result = array();
     foreach ($cursor as $doc) {
         $array = array('id' => (string) $doc[$model->__select2_fields['id']], 'text' => htmlspecialchars($doc[$model->__select2_fields['text']], ENT_QUOTES));
         $result[] = $array;
     }
     return $result;
 }
開發者ID:eazuka,項目名稱:f3-lib,代碼行數:18,代碼來源:ForSelection.php

示例9: getCollection

 protected function getCollection()
 {
     if (null === static::$collection) {
         // connect
         static::$client = new \MongoClient();
         // select a database
         static::$db = static::$client->ik2;
         // select a collection (analogous to a relational database's table)
         static::$collection = static::$db->cronario_jobsss2;
     }
     return static::$collection;
 }
開發者ID:sunnyct,項目名稱:cronario,代碼行數:12,代碼來源:Mongo.php

示例10: forSelection

 /**
  * Helper method for creating select list options
  *
  * @param array $query            
  * @return multitype:multitype:string NULL
  */
 public static function forSelection(array $query = array())
 {
     $model = new static();
     if (!isset($model->__select2_fields['brackets'])) {
         $model->__select2_fields['brackets'] = '';
     }
     if (empty($model->__select2_fields['brackets'])) {
         $cursor = $model->collection()->find($query, [$model->__select2_fields['text'] => 1, $model->__select2_fields['id'] => 1, $model->__select2_fields['slug'] => 1]);
     } else {
         $cursor = $model->collection()->find($query, [$model->__select2_fields['text'] => 1, $model->__select2_fields['id'] => 1, $model->__select2_fields['slug'] => 1, $model->__select2_fields['brackets'] => 1]);
     }
     $cursor->sort(array($model->__select2_fields['text'] => 1));
     $result = array();
     foreach ($cursor as $doc) {
         $arr = [];
         if (empty($model->__select2_fields['brackets'])) {
             $arr = ['id' => (string) $doc[$model->__select2_fields['id']], 'text' => htmlspecialchars($doc[$model->__select2_fields['text']], ENT_QUOTES)];
         } else {
             $arr = ['id' => (string) $doc[$model->__select2_fields['id']], 'text' => htmlspecialchars($doc[$model->__select2_fields['text']], ENT_QUOTES) . ' (' . htmlspecialchars($doc[$model->__select2_fields['brackets']], ENT_QUOTES) . ')'];
         }
         $result[] = $arr;
     }
     return $result;
 }
開發者ID:dioscouri,項目名稱:f3-lib,代碼行數:30,代碼來源:ForSelection.php

示例11: distinctActorTypes

 /**
  * 
  * @param unknown $query
  * @return unknown
  */
 public static function distinctActorTypes($query = array())
 {
     $model = new static();
     $distinct = $model->collection()->distinct("actor_type", $query ? $query : null);
     $distinct = array_values(array_filter($distinct));
     sort($distinct);
     return $distinct;
 }
開發者ID:dioscouri,項目名稱:f3-lib,代碼行數:13,代碼來源:AuditLogs.php

示例12: __construct

 public function __construct($connection = null)
 {
     if ($connection !== null) {
         $this->connection = $connection;
     }
     if (is_string($this->connection)) {
         $this->connection = new Mongo($this->connection);
     }
     if (is_null(self::$collection)) {
         static::$collection = Inflector::lower(get_called_class());
     }
 }
開發者ID:noikiy,項目名稱:inovi,代碼行數:12,代碼來源:Model.php

示例13: setCollection

 /**
  * PluginCollection을 지정한다.
  *
  * @param PluginCollection $collection plugin collection
  *
  * @return void
  */
 public static function setCollection($collection)
 {
     static::$collection = $collection;
 }
開發者ID:xpressengine,項目名稱:xpressengine,代碼行數:11,代碼來源:PluginEntity.php

示例14: distinctStores

 /**
  *
  * @param array $types
  * @return unknown
  */
 public static function distinctStores($query = null)
 {
     $model = new static();
     $distinct = $model->collection()->distinct("storage", $query);
     $distinct = array_values(array_filter($distinct));
     return $distinct;
 }
開發者ID:dioscouri,項目名稱:f3-lib,代碼行數:12,代碼來源:Assets.php

示例15: __construct

 /**
  * Set up class
  *
  * @return void
  */
 public function __construct($collection = null)
 {
     static::$collection = !is_null($collection) ? $collection : new FormatCollection();
 }
開發者ID:danzabar,項目名稱:phalcon-cli,代碼行數:9,代碼來源:Format.php


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