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


PHP ORM::pk方法代码示例

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


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

示例1: remove

 /**
  * Removes a relationship between this model and another.
  *
  * @param   string   alias of the has_many "through" relationship
  * @param   ORM      related ORM model
  * @return  ORM
  */
 public function remove($alias, ORM $model)
 {
     DB::delete($this->_has_many[$alias]['through'])->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())->where($this->_has_many[$alias]['far_key'], '=', $model->pk())->execute($this->_db);
     return $this;
 }
开发者ID:halkeye,项目名称:tops,代码行数:12,代码来源:orm.php

示例2: remove

 /**
  * Removes a relationship between this model and another.
  *
  * @param   string   alias of the has_many "through" relationship
  * @param   ORM      related ORM model
  */
 public function remove($alias, ORM $model)
 {
     $through = ORM::factory($this->_has_many[$alias]['through']);
     // Match this model's primary key in through table
     $col1 = $this->_object_name . $through->_foreign_key_suffix;
     $val1 = $this->pk();
     // Match other model's primary key in through table
     $col2 = $model->_object_name . $through->_foreign_key_suffix;
     $val2 = $model->pk();
     $through->where($col1, '=', $val1)->where($col2, '=', $val2)->delete_all();
 }
开发者ID:ascseb,项目名称:orm,代码行数:17,代码来源:orm.php

示例3: __construct

  /**
   * Creates a new MAttach.
   *
   *     $mattach = new MAttach($user,$log);
   *
   * @param ORM Model
   * @param ORM/String Model to Save
   * @return  void
   */
  public function __construct(ORM $model, $smodel)
  {

    if ($smodel instanceof ORM)
    {
      try
      {
        $this->model = $smodel;
        $this->model->model_id = $model->pk();
        $this->model->model_name = $model->object_name();
      }
      catch (Exception $e)
      {
        throw $e;
      }
    }
    elseif (is_string($smodel))
    {
      try
      {
        $this->model = ORM::factory($smodel);
        $this->model->model_id = $model->pk();
        $this->model->model_name = $model->object_name();
      }
      catch (Exception $e)
      {
        throw $e;
      }
    }
    else
    {
      throw new Exception('WTF?');
    }
  }
开发者ID:nexeck,项目名称:kohana-mattach,代码行数:43,代码来源:core.php

示例4: get

 /**
  * @param ORM $obj
  */
 public static function get($obj)
 {
     return ORM::factory('Seo')->where('model', '=', strtolower($obj->object_name()))->where('pk', '=', $obj->pk())->find();
 }
开发者ID:jfhs,项目名称:amato-seo,代码行数:7,代码来源:Seo.php


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