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


PHP ORM::join_table方法代码示例

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


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

示例1: has

 /**
  * Tests if this object has a relationship to a different model.
  *
  * @param   object   related ORM model
  * @return  boolean
  */
 public function has(ORM $model)
 {
     // Get the plural object name as the related name
     $related = $model->object_plural;
     if (($join_table = array_search($related, $this->has_and_belongs_to_many)) === FALSE) {
         return FALSE;
     }
     if (is_int($join_table)) {
         // No "through" table, load the default JOIN table
         $join_table = $model->join_table($this->table_name);
     }
     if (!isset($this->object_relations[$related])) {
         // Load the object relationships
         $this->changed_relations[$related] = $this->object_relations[$related] = $this->load_relations($join_table, $model);
     }
     if ($model->loaded) {
         // Check if a specific object exists
         return in_array($model->primary_key_value, $this->changed_relations[$related]);
     } else {
         return !empty($this->changed_relations[$related]);
     }
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:28,代码来源:ORM.php

示例2: has

 /**
  * Tests if this object has a relationship to a different model.
  *
  * @param   object   related ORM model
  * @param   boolean  check for any relations to given model
  * @return  boolean
  */
 public function has(ORM $model, $any = FALSE)
 {
     // Determine plural or singular relation name
     $related = $model->table_names_plural === TRUE ? $model->object_plural : $model->object_name;
     if (($join_table = array_search($related, $this->has_and_belongs_to_many)) === FALSE) {
         return FALSE;
     }
     if (is_int($join_table)) {
         // No "through" table, load the default JOIN table
         $join_table = $model->join_table($this->table_name);
     }
     if (!isset($this->object_relations[$related])) {
         // Load the object relationships
         $this->changed_relations[$related] = $this->object_relations[$related] = $this->load_relations($join_table, $model);
     }
     if (!$model->empty_primary_key()) {
         // Check if a specific object exists
         return in_array($model->primary_key_value, $this->changed_relations[$related]);
     } elseif ($any) {
         // Check if any relations to given model exist
         return !empty($this->changed_relations[$related]);
     } else {
         return FALSE;
     }
 }
开发者ID:momoim,项目名称:momo-api,代码行数:32,代码来源:ORM.php

示例3: has

 /**
  * Tests if this object has a relationship to a different model.
  *
  * @param   object   related ORM model
  * @return  boolean
  */
 public function has(ORM $model)
 {
     if (!$this->loaded) {
         return FALSE;
     }
     if (($join_table = array_search(inflector::plural($model->object_name), $this->has_and_belongs_to_many)) === FALSE) {
         return FALSE;
     }
     if (is_int($join_table)) {
         // No "through" table, load the default JOIN table
         $join_table = $model->join_table($this->table_name);
     }
     if ($model->loaded) {
         // Select only objects of a specific id
         $this->db->where($model->foreign_key(NULL, $join_table), $model->primary_key_value);
     }
     // Return the number of rows that exist
     return $this->db->where($this->foreign_key(NULL, $join_table), $this->object[$this->primary_key])->count_records($join_table);
 }
开发者ID:Toushi,项目名称:flow,代码行数:25,代码来源:ORM.php


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