本文整理汇总了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);
}
示例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;
}
}