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


PHP waModel::getTableName方法代码示例

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


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

示例1: doLoad

 /**
  * Called by $this->load() to populate data into $this->persistent->rec_data
  *
  * Subclasses may override this method to tune load() behavior, e.g.
  * to load data lazily by field name passed in $field_or_db_row.
  * Subclasses overriding this should also call parent::doLoad() since the base class
  * uses it to load data from $this->m model.
  *
  * @param array $field_or_db_row see $this->load()
  * @throws waException
  */
 protected function doLoad($field_or_db_row = null)
 {
     // load from array?
     if (is_array($field_or_db_row)) {
         $fields = $this->m->getMetadata();
         $nulls = array_fill_keys(array_keys($fields), null);
         $this->persistent->setAll(array_intersect_key($field_or_db_row, $fields) + $nulls);
         return;
     }
     // requested field already loaded?
     if ($field_or_db_row) {
         // check if can be loaded from $this->m model
         if (!array_key_exists($field_or_db_row, $this->m->getMetadata())) {
             return;
         }
     } else {
         $loaded = true;
         foreach ($this->m->getMetadata() as $f => $v) {
             if (!$this->persistent->keyExists($f)) {
                 $loaded = false;
                 break;
             }
         }
         if ($loaded) {
             return;
         }
     }
     // load from model
     $row = $this->m->getById($this->id);
     if (!$row) {
         throw new waException('No record found in ' . $this->m->getTableName() . ' for id=' . $this->id, 404);
     }
     $this->persistent->setAll($row);
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:45,代码来源:waDbRecord.class.php

示例2: getSQL

 protected function getSQL()
 {
     $sql = "SELECT " . $this->select . " FROM " . $this->model->getTableName();
     if ($this->where) {
         $sql .= " WHERE (" . implode(") AND (", $this->where) . ")";
     }
     if ($this->order) {
         $sql .= " ORDER BY " . $this->order;
     }
     if ($this->limit) {
         $sql .= " LIMIT " . $this->limit;
     }
     return $sql;
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:14,代码来源:waDbQuery.class.php

示例3: genUniqueUrl

 /**
  * @param $url
  * @param waModel $context
  * @param int $length
  * @param string $field
  * @return string
  */
 public static function genUniqueUrl($url, $context, &$counter = 0, $length = 512, $field = 'url')
 {
     $counter = 0;
     $url = preg_replace('/\\s+/', '-', $url);
     $url = shopHelper::transliterate($url);
     if (strlen($url) == 0) {
         $url = (time() << 24) + $counter++;
     } else {
         $url = mb_substr($url, 0, $length);
     }
     $url = mb_strtolower($url);
     $pattern = mb_substr($context->escape($url, 'like'), 0, $length - 3) . '%';
     $sql = "SELECT `{$field}` FROM {$context->getTableName()} WHERE url LIKE '{$pattern}' ORDER BY LENGTH(`{$field}`)";
     $alike = $context->query($sql)->fetchAll('url');
     if (is_array($alike) && isset($alike[$url])) {
         $last = array_shift($alike);
         $counter = 1;
         do {
             $modifier = "-{$counter}";
             $_length = mb_strlen($modifier);
             $url = mb_substr($last['url'], 0, $length - $_length) . $modifier;
         } while (isset($alike[$url]) && ++$counter < 100);
         if (isset($alike[$url])) {
             $short_uuid = (time() << 24) + $counter++;
             $_length = mb_strlen($short_uuid);
             $url = mb_substr($last['url'], 0, $length - $_length) . $short_uuid;
         }
     }
     return mb_strtolower($url);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:37,代码来源:shopHelper.class.php


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