當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。