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