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


PHP ClassInfo::hastable方法代码示例

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


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

示例1: delete

 /**
  * Delete this data object.
  * $this->onBeforeDelete() gets called.
  * Note that in Versioned objects, both Stage and Live will be deleted.
  */
 public function delete()
 {
     $this->brokenOnDelete = true;
     $this->onBeforeDelete();
     if ($this->brokenOnDelete) {
         user_error("{$this->class} has a broken onBeforeDelete() function.  Make sure that you call parent::onBeforeDelete().", E_USER_ERROR);
     }
     foreach ($this->getClassAncestry() as $ancestor) {
         if (ClassInfo::hastable($ancestor)) {
             $sql = new SQLQuery();
             $sql->delete = true;
             $sql->from[$ancestor] = "`{$ancestor}`";
             $sql->where[] = "ID = {$this->ID}";
             $this->extend('augmentSQL', $sql);
             $sql->execute();
         }
     }
     $this->OldID = $this->ID;
     $this->ID = 0;
     DataObjectLog::deletedObject($this);
 }
开发者ID:ramziammar,项目名称:websites,代码行数:26,代码来源:DataObject.php

示例2: buildSelected

 protected function buildSelected($fields, &$ret, $includeAllFields = true)
 {
     if ($includeAllFields) {
         $ret1 = array();
         foreach (ClassInfo::subclassesFor($this->baseClass) as $subClass) {
             if (ClassInfo::hastable($subClass)) {
                 if ($columns = $this->getColumnsInTable($subClass)) {
                     foreach ($columns as $column) {
                         if (!in_array($column, $ret1)) {
                             $ret[] = "`{$subClass}`.`{$column}`";
                             $ret1[] = $column;
                         }
                     }
                 }
             }
         }
         if ($this->joinedTables) {
             foreach ($this->joinedTables as $table) {
                 $columns = $this->getColumnsInTable($table);
                 if ($columns) {
                     foreach ($columns as $column) {
                         if (!in_array($column, $ret1)) {
                             $ret[] = "`{$table}`.`{$column}`";
                             $ret1[] = $column;
                         }
                     }
                 }
             }
         }
     } else {
         foreach ($fields as $field) {
             if (is_array($field)) {
                 $this->buildSelected($field, $ret);
             } else {
                 if ($count = preg_match('/^(.+)->(.+)$/', $field, $matches)) {
                     $field = $matches[1];
                 }
                 if (!preg_match('/^(.+)\\.(.+)$/', $field, $matches)) {
                     if ($this->is_inTables($field)) {
                         $ret[] = $field;
                     }
                 } else {
                     $ret[] = $field;
                 }
             }
         }
     }
     foreach ($this->customSelect as $filter) {
         $ret[] = $filter;
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:51,代码来源:DataReport.php


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