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


PHP Selection::select方法代碼示例

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


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

示例1: setMapping

 /**
  * @param array $mapping
  */
 public function setMapping(array $mapping)
 {
     parent::setMapping($mapping);
     foreach ($mapping as $k => $m) {
         $this->selection->select("{$m} AS `{$k}`");
     }
 }
開發者ID:lohini,項目名稱:cf,代碼行數:10,代碼來源:DB.php

示例2: select

 public function select($columns)
 {
     if (!$this->sqlBuilder->getSelect()) {
         $this->sqlBuilder->addSelect("{$this->name}.{$this->column}");
     }
     return parent::select($columns);
 }
開發者ID:BroukPytlik,項目名稱:agility,代碼行數:7,代碼來源:GroupedSelection.php

示例3: select

 public function select($columns)
 {
     if (!$this->select) {
         $this->select[] = "{$this->delimitedName}.{$this->delimitedColumn}";
     }
     return parent::select($columns);
 }
開發者ID:bazo,項目名稱:Tatami,代碼行數:7,代碼來源:GroupedSelection.php

示例4: setRelated

 public function setRelated($table, $key, $column, $as = NULL, $primary = 'id')
 {
     if (is_null($this->context)) {
         throw new Grid_Exception('Related require set Nette database context in constructor.');
     }
     $this->related[$table] = array($table, $key, $column, $as, $primary);
     $this->nette_table->select($table . '.' . $column . (!is_null($as) ? ' AS ' . $as : ''));
     return $this;
 }
開發者ID:adusak,項目名稱:DataGrid,代碼行數:9,代碼來源:NetteDbDataSource.php

示例5: configure

 protected function configure($presenter)
 {
     $this->selection->select("error.id, title, message, error_dt, project_id.name AS project_name, error_status_id.status AS status");
     $source = new \NiftyGrid\DataSource\NDataSource($this->selection);
     $self = $this;
     $this->setDataSource($source);
     $this->setDefaultOrder("error_dt DESC");
     $this->addColumn("project_name", "Project")->setTableName("project_id")->setSortable()->setSelectFilter($this->projectEntity->findAll()->fetchPairs("id", "name"));
     $this->addColumn("title", "Title")->setTextFilter()->setSortable();
     $this->addColumn("message", "Message")->setSortable()->setTextFilter()->setRenderer(function ($row) use($presenter) {
         return \Nette\Utils\Html::el("a")->setText(trim($row["message"]) ? Strings::truncate($row["message"], 60) : $row["id"])->addAttributes(array("target" => "_blank"))->href($presenter->link("ErrorList:display", $row["id"]));
     });
     $this->addColumn("status", "Status")->setTableName("error_status_id")->setSelectFilter($this->lstErrorStatus->findAll()->fetchPairs("id", "status"))->setRenderer(function ($row) use($presenter) {
         $label = "";
         if ($row["status"] == "New") {
             $label = "label-important";
         }
         return \Nette\Utils\Html::el("span")->setText($row["status"])->addAttributes(array("class" => "label {$label}"));
     });
     if (!isset($this->filter['status'])) {
         $this->filter['status'] = '1';
     }
     $this->addColumn("error_dt", "Date", "150px")->setDateFilter()->setSortable()->setRenderer(function ($row) {
         return $row["error_dt"]->format("j.n.Y H:i:s");
     });
     $this->addButton("archive", "Archive")->setText("Archive")->setAjax()->setLink(function ($row) use($presenter) {
         return $presenter->link("archive!", $row['id']);
     })->setClass("btn-success btn-solve");
     /*
     		$this->addButton("createTask", "Create Task")
     			->setText('Create task')
     			->setAjax()
     			->setLink(function($row) use ($presenter){return $presenter->link("createTask!", $row['id']);})
     			->setClass("btn-info");
     */
     $this->addAction("archive", "Archive")->setAjax(true)->setCallback(function ($selectedItems) use($self) {
         $self->handleArchive($selectedItems);
     });
     $this->addAction("unarchive", "Unarchive")->setAjax(true)->setCallback(function ($selectedItems) use($self) {
         $self->handleUnArchive($selectedItems);
     });
 }
開發者ID:RiKap,項目名稱:ErrorMonitoring,代碼行數:42,代碼來源:ErrorGrid.php

示例6: apply

 /**
  * @param \Nette\Database\Table\Selection $selection
  * @param string|Callable $callback
  */
 private function apply(Selection $selection, $callback)
 {
     if (!$callback) {
         return;
     }
     if (is_string($callback)) {
         $selection->select($callback);
     } else {
         $callback($selection);
     }
 }
開發者ID:kysela-petr,項目名稱:generator-kysela,代碼行數:15,代碼來源:MenuItemDataSource.php

示例7: aggregation

 public function aggregation($function)
 {
     $aggregation =& $this->refTable->aggregation[$function . implode('', $this->where) . implode('', $this->conditions)];
     if ($aggregation === NULL) {
         $aggregation = array();
         $selection = new Selection($this->name, $this->connection);
         $selection->where = $this->where;
         $selection->parameters = $this->parameters;
         $selection->conditions = $this->conditions;
         $selection->select($function);
         $selection->select("{$this->name}.{$this->column}");
         $selection->group("{$this->name}.{$this->column}");
         foreach ($selection as $row) {
             $aggregation[$row[$this->column]] = $row;
         }
     }
     if (isset($aggregation[$this->active])) {
         foreach ($aggregation[$this->active] as $val) {
             return $val;
         }
     }
 }
開發者ID:exesek,項目名稱:nette20login,代碼行數:22,代碼來源:GroupedSelection.php

示例8: setSelect

 /**
  * @param string $select
  * @return self
  */
 public function setSelect($select)
 {
     $this->source->select($select);
     return $this;
 }
開發者ID:WebChemistry,項目名稱:filter,代碼行數:9,代碼來源:NetteDataSource.php

示例9: aggregation

 /**
  * Executes aggregation function.
  * @param  string
  * @return string
  */
 public function aggregation($function)
 {
     $selection = new Selection($this->name, $this->connection);
     $selection->where = $this->where;
     $selection->parameters = $this->parameters;
     $selection->conditions = $this->conditions;
     $selection->select($function);
     foreach ($selection->fetch() as $val) {
         return $val;
     }
 }
開發者ID:kravco,項目名稱:nette,代碼行數:16,代碼來源:Selection.php


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