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


PHP Inflector::tabelize方法代碼示例

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


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

示例1: ActiveRecord

 public function ActiveRecord($params = array())
 {
     $this->__class_name = $this->getClassName();
     $this->__table_name = Inflector::tabelize($this->__class_name);
     $this->__fields = ActiveRecord::connection()->getTableInfo($this->__table_name)->getFields();
     $this->__primary_key = current(array_filter($this->__fields, array($this, '__pk')));
     foreach ($params as $key => $value) {
         $this->{$key} = $value;
     }
 }
開發者ID:aurelian,項目名稱:medick2,代碼行數:10,代碼來源:Base.php

示例2: compile

 /**
  * Compile an SQLCommand from this query clauses.
  * 
  * Valid Clauses:
  * <ul>
  *  <li>'from'      => to add an additional from clause</li>
  *  <li>'condition' => to insert a sql condition</li>
  *  <li>'order by'  => to set an order by</li>
  *  <li>'columns'   => specify only the columns you want to select (check if it work on aliases too?)</li>
  *  <li>'limit'     => adjust the limit (this is not sended to the SQLCommand since is intended to be used with PreparedStatements)</li>
  *  <li>'offset'    => adds an offset (this is not sended to the SQLCommand since is intended to be used with PreparedStatements)</li>
  *  <li>'left join' => add a left join</li>
  * </ul>
  *
  * @return SQLCommand
  */
 public function compile()
 {
     if (isset($this->clauses['include'])) {
         $this->clauses['left join'] = Inflector::pluralize($this->clauses['include']) . ' on ' . Inflector::pluralize($this->clauses['include']) . '.id=' . Inflector::tabelize($this->owner) . '.' . $this->clauses['include'] . '_id';
     }
     $command = SQLCommand::select()->from(Inflector::tabelize($this->owner));
     if (isset($this->clauses['from'])) {
         $command->from($this->clauses['from']);
     }
     if (isset($this->clauses['condition'])) {
         $command->where($this->clauses['condition']);
     }
     if (isset($this->clauses['order by'])) {
         $command->orderBy($this->clauses['order by']);
     }
     if (isset($this->clauses['columns'])) {
         $command->columns($this->clauses['columns']);
     }
     if (isset($this->clauses['limit'])) {
         $this->limit = $this->clauses['limit'];
     }
     if (isset($this->clauses['offset'])) {
         $this->offset = $this->clauses['offset'];
     }
     if (isset($this->clauses['left join'])) {
         $command->leftJoin('left outer join ' . $this->clauses['left join']);
     }
     return $command;
 }
開發者ID:BackupTheBerlios,項目名稱:medick-svn,代碼行數:45,代碼來源:SQLBuilder.php


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