本文整理匯總了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;
}
}
示例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;
}