我有 2000,1066,不是唯一的表/别名:'类别' 此错误。我很清楚这是什么问题。
我的代码:
$f3->route('POST /', function($f3, $params) {
if(isset($_POST['/latest']))
{
echo "accept";
}
}
genrate以下查询
static $belongs_to = array(
array('Parent',
'foreign_key'=>'parent_id',
'class_name'=>'categoryModel',
),
array('gallery','class_name'=>'galleryModel','foreign_key'=>'image_id'),
);
我需要使用别名,但我不知道如何在php ActiveRecord中使用别名
型号代码是:
SELECT `category`.* FROM `category` INNER JOIN `category` ON(`category`.parent_id = `category`.category_id)
和appModel代码:
<?php
class categoryModel extends appModel
{
static $table_name = '`category`';
static $primary_key = 'category_id';
static $belongs_to = array(
array('Parent',
'foreign_key'=>'parent_id',
'class_name'=>'categoryModel',
// 'conditions' => 'parent.parent_id is null'
),
array('gallery','class_name'=>'galleryModel','foreign_key'=>'image_id'),
);
static $has_many = array(
array('cr','class_name'=>'category_relationModel','foreign_key'=>'category_id')
);
static $delegate = array(
array('name', 'to' => 'parent', 'prefix' => 'parent'));
}
答案 0 :(得分:0)
我已经完成使用核心代码更改。
更改 Table.php
方法: <div align="center"><span class="fixedbutton">Some text here</span></div>
public static bool SelfDescribing(string num)
{
char[] digit = num.ToArray();
int bound = digit.Count();
for (int i = 0; digit.Length != 0 && i < bound; i++)
{
int arrLength = 0;
var count = num.Count(x => x == digit[i]);
if (count == i)
{
arrLength++;
if (arrLength == bound)
{
return true;
}
}
}
return false;
}
改变是
create_joins($joins)
$ value是关系名称