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


PHP model::getTable方法代码示例

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


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

示例1: includes

 /**
  * Itterate over object, build a relations, fillable and includes collection.
  *
  * @param model $object the model to iterate over
  *
  * @return array
  */
 private function includes($object)
 {
     $fillable = $object->getFillable();
     $includes = $object->getIncludes();
     $table = $object->getTable();
     $columns = $object->columns();
     $results[$table] = [];
     if (!empty($includes)) {
         foreach ($includes as $include) {
             $results[$table] = ['object' => $object, 'includes' => $this->includes(new $include())];
         }
     }
     $this->fillables->put($table, $fillable);
     $this->includes->push($table, $table);
     $this->columns->put($table, $columns);
     return $results;
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:24,代码来源:ApiObjects.php

示例2: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $listModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getAvgQuery(&$listModel, $label = "'calc'")
 {
     $table =& $listModel->getTable();
     $joinSQL = $listModel->_buildQueryJoin();
     $whereSQL = $listModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     return "SELECT FROM_UNIXTIME(AVG(UNIX_TIMESTAMP({$name}))) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
 }
开发者ID:nickbunyan,项目名称:fabrik,代码行数:14,代码来源:date.php

示例3: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param	model	$listModel
  * @param	string	$label the label to apply to each avg
  * @return	string	sql statement
  */
 protected function getAvgQuery(&$listModel, $label = "'calc'")
 {
     $item = $listModel->getTable();
     $joinSQL = $listModel->_buildQueryJoin();
     $whereSQL = $listModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     $groupModel = $this->getGroup();
     $roundTo = (int) $this->getParams()->get('avg_round');
     if ($groupModel->isJoin()) {
         //element is in a joined column - lets presume the user wants to sum all cols, rather than reducing down to the main cols totals
         return "SELECT ROUND(AVG({$name}), {$roundTo}) AS value, {$label} AS label FROM " . FabrikString::safeColName($item->db_table_name) . " {$joinSQL} {$whereSQL}";
     } else {
         // need to do first query to get distinct records as if we are doing left joins the sum is too large
         return "SELECT ROUND(AVG(value), {$roundTo}) AS value, label\nFROM (SELECT DISTINCT {$item->db_primary_key}, {$name} AS value, {$label} AS label FROM " . FabrikString::safeColName($item->db_table_name) . " {$joinSQL} {$whereSQL}) AS t";
     }
 }
开发者ID:romuland,项目名称:khparts,代码行数:22,代码来源:element.php

示例4: getMedianQuery

 /**
  * build the query for the avg caclculation
  * @param model $listModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getMedianQuery(&$listModel, $label = "'calc'")
 {
     $fields = $listModel->getDBFields($this->getTableName(), 'Field');
     if ($fields[$this->getElement()->name]->Type == 'time') {
         $name = $this->getFullName(false, false, false);
         $table =& $listModel->getTable();
         $joinSQL = $listModel->_buildQueryJoin();
         $whereSQL = $listModel->_buildQueryWhere();
         return "SELECT SEC_TO_TIME(TIME_TO_SEC({$name})) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
     } else {
         return parent::getMedianQuery($listModel, $label);
     }
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:19,代码来源:calc.php

示例5: getMedianQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $tableModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getMedianQuery(&$tableModel, $label = "'calc'")
 {
     $table =& $tableModel->getTable();
     $joinSQL = $tableModel->_buildQueryJoin();
     $whereSQL = $tableModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     //return "SELECT DATE_FORMAT(FROM_UNIXTIME((UNIX_TIMESTAMP($name))), '%H:%i:%s') AS value, $label AS label FROM `$table->db_table_name` $joinSQL $whereSQL";
     return "SELECT SEC_TO_TIME(TIME_TO_SEC({$name})) AS value, {$label} AS label FROM `{$table->db_table_name}` {$joinSQL} {$whereSQL}";
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:15,代码来源:fabriktimer.php

示例6: getAvgQuery

 /**
  * build the query for the avg caclculation - can be overwritten in plugin class (see date element for eg)
  * @param model $tableModel
  * @param string $label the label to apply to each avg
  * @return string sql statement
  */
 protected function getAvgQuery(&$tableModel, $label = "'calc'")
 {
     $table =& $tableModel->getTable();
     $joinSQL = $tableModel->_buildQueryJoin();
     $whereSQL = $tableModel->_buildQueryWhere();
     $name = $this->getFullName(false, false, false);
     $groupModel =& $this->getGroup();
     if ($groupModel->isJoin()) {
         //element is in a joined column - lets presume the user wants to sum all cols, rather than reducing down to the main cols totals
         return "SELECT ROUND(AVG({$name})) AS value, {$label} AS label FROM " . FabrikString::safeColName($table->db_table_name) . " {$joinSQL} {$whereSQL}";
     } else {
         // need to do first query to get distinct records as if we are doing left joins the sum is too large
         //return "SELECT ROUND(AVG(value)) AS value, label FROM (SELECT DISTINCT ".FabrikString::safeColName($table->db_table_name.'.'.$table->db_primary_key).", $name AS value, $label AS label FROM ".FabrikString::safeColName($table->db_table_name)." $joinSQL $whereSQL) AS t";
         return "SELECT ROUND(AVG(value)) AS value, label FROM (SELECT DISTINCT " . FabrikString::safeColName($table->db_table_name . '.' . $table->db_primary_key) . ", {$name} AS value, {$label} AS label FROM " . FabrikString::safeColName($table->db_table_name) . " {$joinSQL} {$whereSQL}) AS t";
     }
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:22,代码来源:element.php


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