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


PHP Jelly::join_alias方法代码示例

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


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

示例1: with

 /**
  * Implementation of Jelly_Field_Behavior_Joinable
  *
  * @param   Jelly_Builder  $builder
  * @return  void
  */
 public function with($builder)
 {
     $join_col1 = $this->model . '.' . $this->column;
     // We use this field's alias rather than the foreign model so the join alias can be resolved
     $join_col2 = $this->name . '.' . $this->foreign['column'];
     $builder->join(array($this->foreign['model'], Jelly::join_alias($this)), 'LEFT')->on($join_col1, '=', $join_col2);
 }
开发者ID:vitch,项目名称:kohana-jelly,代码行数:13,代码来源:belongsto.php

示例2: _column

 /**
  * This is an internal method used for aliasing only things coming
  * to the query builder, since they can come in so many formats.
  *
  * $value is passed so the :unique_key meta alias can be used.
  *
  * @param   string   $field
  * @param   boolean  $join
  * @param   mixed    $value
  * @return  string
  */
 protected function _column($field, $join = TRUE, $value = NULL)
 {
     $model = NULL;
     // Check for functions
     if (strpos($field, '"') !== FALSE) {
         // Quote the column in FUNC("ident") identifiers
         return preg_replace('/"(.+?)"/e', '"\\"".$this->_column("$1")."\\""', $field);
     }
     // Test for Database Expressions
     if ($field instanceof Database_Expression) {
         return $field;
     }
     // Set if we find this is a reference to a joined field
     $join_table_alias = FALSE;
     // Field has no model
     if (strpos($field, '.') === FALSE) {
         // If we have a meta alias with no model use this model to resolve it
         // or if we have a valid field for this model assume that's what we mean
         if (strpos($field, ':') !== FALSE or $this->_meta and $this->_meta->fields($field)) {
             $field = $this->_model . '.' . $field;
         } else {
             // This is not a model field or meta alias, so don't bother trying to alias it and
             // return it as it is
             return $field;
         }
     } else {
         list($model, $field) = explode('.', $field, 2);
         // Check to see if the 'model' passed is actually a relationship alias
         if ($field_object = $this->_meta->fields($model) and $field_object instanceof Jelly_Field_Behavior_Joinable) {
             // The model specified looks like a relationship alias in this context
             // that means we alias the field name to a column but use the join alias for the table
             $join_table_alias = Jelly::join_alias($field_object);
             // Change the field to use the appropriate model so it can be properly aliased
             $field = $field_object->foreign['model'] . '.' . $field;
         } else {
             // Put field back together
             $field = $model . '.' . $field;
         }
     }
     $alias = Jelly::alias($field, $value);
     if ($join_table_alias) {
         // Replace the actual table with the join alias
         $alias['table'] = $join_table_alias;
     }
     if ($join) {
         return implode('.', $alias);
     } else {
         return $alias['column'];
     }
 }
开发者ID:rcapp,项目名称:kohana-jelly,代码行数:61,代码来源:core.php


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