我正在使用 symfony 1.4 和教义,我目前在 schema.yml 上为我的 2 个表创建了结构,但是当我进行查询时,我得到了这个异常
SQLSTATE [42S22]:未找到列:1054 'on 子句'中的未知列 'o.id'。查询失败:“SELECT o.id_aditional_details AS o__id_aditional_details, o.name AS o_ name, o.type AS o _type, o.group AS o__group FROM ohrm_aditional_details o INNER JOIN ohrm_details_info o2 ON o.id = o2.ohrm_aditional_details_id WHERE (o2.user = 4)"
我必须要表格,details_info
并且aditional_details
,附加详细信息需要在其中一个字段中包含 details_info 中一个条目的 id,我不知道这个错误,因为我已经用其他表格完成了,但这次我不知道发生了什么......
我的 schema.yml 是这样的
OhrmAditionalDetails:
connection: doctrine
tableName: ohrm_aditional_details
columns:
id_aditional_details:
type: integer(11)
fixed: false
unsigned: false
primary: true
autoincrement: true
name:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
type:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
group:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
OhrmDetailsInfo:
connection: doctrine
tableName: ohrm_details_info
columns:
id_details_info:
type: integer(11)
fixed: false
unsigned: false
primary: true
autoincrement: true
aditional_info:
type: integer(11)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
result:
type: string(200)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
user:
type: integer(11)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
relations:
OhrmAditionalDetails:
local: aditional_info
foreign: id_aditional_details
type: one
HsHrEmployee:
local: user
foreign: emp_number
type: one
和我的查询,很简单
try
{
$q = Doctrine_Query::create()
->select('*')
->from('OhrmAditionalDetails D')
->innerJoin('D.OhrmDetailsInfo I')
->where("I.user = $id");
$result = $q->execute();
return $result;
}
catch(Exception $e)
{
print_r ($e->getMessage());
return null;
}
在 $id = 4 的情况下
任何想法?我试过了
php symfony cc
php symfony doctrine:build-model
php symfony orangehrm:publish-assets
php symfony cc
但没有...