当前位置: 首页>>代码示例>>PHP>>正文


PHP self::select方法代码示例

本文整理汇总了PHP中self::select方法的典型用法代码示例。如果您正苦于以下问题:PHP self::select方法的具体用法?PHP self::select怎么用?PHP self::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在self的用法示例。


在下文中一共展示了self::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUsers

 public static function getUsers()
 {
     $userModel = new self();
     $select = $userModel->select();
     $select->order(array('last_name', 'first_name'));
     return $userModel->fetchAll($select);
 }
开发者ID:mtaha1990,项目名称:onlineDR,代码行数:7,代码来源:User.php

示例2: findDirectories

 /**
  * Begins search for directories matching mask.
  * @param  mixed
  * @return Finder
  */
 public static function findDirectories($mask)
 {
     if (!is_array($mask)) {
         $mask = func_get_args();
     }
     $finder = new self();
     return $finder->select($mask, 'isDir');
 }
开发者ID:jff15,项目名称:travelbot,代码行数:13,代码来源:Finder.php

示例3: getCountryName

 public function getCountryName($code = NULL)
 {
     $table = new self();
     $rName = $table->info('name');
     $select = $table->select()->from($rName);
     $select->where('iso_code_3 = ?', $code);
     $item = $table->fetchRow($select);
     return $item->name;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:9,代码来源:Countries.php

示例4: getLatestCommentByUserId

 public static function getLatestCommentByUserId($userId)
 {
     $status = new self();
     $status->setProjection(array("comment"));
     $status->setCondition("user_id", $userId);
     $status->setOrderBy("created_at", "desc");
     $status->setLimit(1);
     $statuses = $status->select();
     return isset($statuses[0]) ? $statuses[0]->comment : "";
 }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:10,代码来源:Status.php

示例5: getConversation

 public static function getConversation($IDMessage)
 {
     $TheMessage = new self();
     $Select = $TheMessage->select()->join(array('mm' => 'message'), 'message.IDParent = mm.IDParent', array())->where("mm.IDMessage = '{$IDMessage}'")->order("mm.Date");
     $Messages = $TheMessage->fetchAll($Select);
     $Ret = array();
     if ($Messages) {
         foreach ($Messages as $Message) {
             $TheMessage = new self();
             $Ret[] = $TheMessage->copyFromDb($Message);
         }
     }
     return $Ret;
 }
开发者ID:BGCX262,项目名称:zweer-gdr-svn-to-git,代码行数:14,代码来源:Messaggio.php

示例6: remove

 /**
  * 删除回复
  */
 public static final function remove()
 {
     $online = front::online();
     //if(!parent::init('in_manager') || $online->grade!=1) die('Permission Denied!');
     // 获取数据
     $doc_remark = new self();
     $doc_remark->doc_remark_id = isset($_GET['doc_remark_id']) ? $_GET['doc_remark_id'] : null;
     if (!is_numeric($doc_remark->doc_remark_id) || !$doc_remark->select()) {
         $error = '该回复不存在';
         return;
     }
     // 删除数据
     $doc_remark->delete();
     header('Location: ?' . $_GET['query']);
 }
开发者ID:antsmallant,项目名称:coreapp,代码行数:18,代码来源:doc_remark.php

示例7: remove

 /**
  * 删除用户
  */
 public static final function remove()
 {
     // 获取数据
     $user = new self();
     $user->user_id = isset($_GET['user_id']) ? $_GET['user_id'] : null;
     if (!is_numeric($user->user_id) || !$user->select()) {
         $error = '该用户不存在';
         self::view(__CLASS__ . '/error.tpl', compact('error'));
         return;
     }
     // 删除数据
     $user->delete();
     header('Location: ?' . $_GET['query']);
 }
开发者ID:antsmallant,项目名称:coreapp,代码行数:17,代码来源:user.php

示例8: remove

 /**
  * 删除日志
  */
 public static final function remove()
 {
     // 获取数据
     $book = new self();
     $book->book_id = isset($_GET['book_id']) ? $_GET['book_id'] : null;
     if (!is_numeric($book->book_id) || !$book->select()) {
         $error = '该日志不存在';
         front::view2('error.tpl', compact('error'));
         return;
     }
     // 删除数据
     $book->delete();
     header('Location: ?' . $_GET['query']);
 }
开发者ID:antsmallant,项目名称:coreapp,代码行数:17,代码来源:book.php

示例9: fetchAllGroups

 /**
  * Return an array of all groups.
  *
  * @return array
  */
 public static function fetchAllGroups()
 {
     $model = new self();
     $result = [];
     try {
         foreach ($model->select('group')->distinct()->get() as $row) {
             $result[] = $row->group;
         }
     } catch (\Exception $e) {
         // Do nothing.
     }
     return $result;
 }
开发者ID:delatbabel,项目名称:site-config,代码行数:18,代码来源:Config.php

示例10: remove

 /**
  * 删除分类
  */
 public static final function remove()
 {
     // 获取数据
     $channel = new self();
     $channel->channel_id = isset($_GET['channel_id']) ? $_GET['channel_id'] : null;
     if (!is_numeric($channel->channel_id) || !$channel->select()) {
         $error = '该分类不存在';
         front::view2('error.tpl', compact('error'));
         return;
     }
     //分类下不能有数据
     $count = self::selects('COUNT(*)', null, array('typeid' => $channel->channel_id), null, array('column|table=doc' => 'COUNT(*)'));
     if ($count > 0) {
         $error = '分类下还有数据不能删除';
         front::view2('error.tpl', compact('error'));
         return;
     } else {
         $count = self::selects('COUNT(*)', null, array('parent_id' => $channel->channel_id), null, array('column|table=channel' => 'COUNT(*)'));
         if ($count > 0) {
             $error = '分类下还有分类不能删除';
             front::view2('error.tpl', compact('error'));
             return;
         }
     }
     // 删除数据
     $channel->delete();
     header('Location: ?' . $_GET['query']);
 }
开发者ID:antsmallant,项目名称:coreapp,代码行数:31,代码来源:channel.php

示例11: init

 /**
  * @since 1.3
  *
  * @return string
  */
 public static function init($value, $inputName, $isMandatory, $isDisabled, $otherArgs)
 {
     $instance = new self($GLOBALS['wgParser']);
     return $instance->select($value, $inputName, $isMandatory, $isDisabled, $otherArgs);
 }
开发者ID:paladox,项目名称:SemanticFormsSelect,代码行数:10,代码来源:SemanticFormsSelect.php

示例12: compact

 public static function compact($collection = null)
 {
     $collection = self::_collection($collection);
     $__ = new self();
     return $__->select($collection, function ($val) {
         return (bool) $val;
     });
 }
开发者ID:ZeusFramework,项目名称:Underscore.php,代码行数:8,代码来源:underscore.php

示例13: getUniqUsers

 /**
  *
  * @return mixed
  */
 public static function getUniqUsers()
 {
     $obj = new self();
     return $obj->select('user_id')->distinct()->get()->all_to_array('user_id');
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:9,代码来源:reviews_notification.php

示例14: remove

 /**
  * 删除用户
  */
 public static final function remove()
 {
     if (!self::user_level(2, __CLASS__, __FUNCTION__)) {
         return;
     }
     $online = front::online();
     // 获取数据
     $user = new self();
     $user->user_id = isset($_GET['user_id']) ? $_GET['user_id'] : null;
     if (!is_numeric($user->user_id) || !$user->select()) {
         $error = '该用户不存在';
         front::view2('common/error.tpl', compact('error'));
         return;
     }
     if ($online->user_id == $user->user_id || $user->grade == 1) {
         $error = '此用户不能删除';
         front::view2('common/error.tpl', compact('error'));
         return;
     }
     // 删除数据
     $user->delete();
     header('Location: ?' . $_GET['query']);
 }
开发者ID:antsmallant,项目名称:coreapp,代码行数:26,代码来源:user.php

示例15: select

 /**
  * Return a new collection where each element is a subselection of the original element.
  * (Known as "collect" in Ruby or "pluck" in underscore.js).
  *
  * @param string|array      $selector  Path to the variable to select. Examples: "->id", "[message]", "customer.name", array('id' => 'message_id', 'message' => 'message_text')
  * @param string|null|false $selectKey (optional) The path that will be used as key. false: Keep the current key, null:  create linear keys.
  *
  * @return Collection
  */
 public function select($selector, $selectKey = false)
 {
     if ($this->data !== null || is_string($this->sql) || is_object($selector) && is_callable($selector)) {
         return parent::select($selector, $selectKey);
     }
     if (is_int($selector)) {
         $selector = (string) $selector;
     }
     $selectorPaths = is_string($selector) ? array($selector => $selector) : $selector;
     $hasKeySelector = $selectKey !== false && $selectKey !== null;
     if ($hasKeySelector) {
         \Sledgehammer\array_key_unshift($selectorPaths, $selectKey, $selectKey);
     }
     if (count($selectorPaths) === 0) {
         // empty selector?
         return parent::select($selector, $selectKey);
     }
     $isWildcardSelector = $this->sql->columns === '*' || $this->sql->columns == array('*' => '*');
     if ($isWildcardSelector === false && (is_string($this->sql->columns) || count($selectorPaths) >= count($this->sql->columns))) {
         // The selector can't be a subsection of current columns.
         return parent::select($selector, $selectKey);
     }
     $columns = [];
     foreach ($selectorPaths as $to => $from) {
         $column = $this->convertPathToColumn($from);
         $alias = $this->convertPathToColumn($to);
         if ($column === false || $alias === false) {
             // Path can't be mapped to column
             return parent::select($selector, $selectKey);
         }
         if ($isWildcardSelector === false) {
             if (isset($this->sql->columns[$column])) {
                 $column = $this->sql->columns[$column];
                 // Use the original column/calculation (just change the alias)
             } else {
                 // @todo Use array_search() for support of indexed array of columns.
                 return parent::select($selector, $selectKey);
             }
         }
         if ($hasKeySelector) {
             $alias = $column;
             // Don't alias in SQL, but (re)use the $selector.
         }
         $columns[$alias] = $column;
     }
     $collection = new self($this->sql->select($columns), $this->dbLink);
     if ($hasKeySelector || is_string($selector)) {
         // Does the $collection requires additional selecting?
         return $collection->select($selector, $selectKey);
     }
     return $collection;
 }
开发者ID:sledgehammer,项目名称:core,代码行数:61,代码来源:DatabaseCollection.php


注:本文中的self::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。