php - Doctrine_Query 中的问题
问题描述
以下 PHP/Doctrine 查询无法正常工作
$q = Doctrine_Query::create();
$q->from('EEvaluationround ER');
$q->leftJoin('ER.EEvaluationroundUser ERU');
$q->where('ER.job_id = ? and ER.active = 1 and (ERU.user_id = ? or ER.leader_user_id = ?)', array($this->job_id, $user->user_id, $user->user_id));
$res = $q->execute();
在schema.yml我们有这个
EEvaluationround:
tableName: e_evaluationround
columns:
evaluationround_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
job_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
roundtype_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
default: '10'
notnull: true
autoincrement: false
leader_user_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
default: '0'
notnull: true
autoincrement: false
autoadd:
type: integer(1)
fixed: false
unsigned: true
primary: false
default: '0'
notnull: true
autoincrement: false
active:
type: integer(1)
fixed: false
unsigned: true
primary: false
default: '1'
notnull: true
autoincrement: false
evaluationround_name:
type: string(30)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
relations:
Job:
local: job_id
foreign: job_id
EEvaluationroundUser:
tableName: e_evaluationround_user
columns:
evaluationround_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: false
user_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: false
active:
type: integer(1)
fixed: false
unsigned: true
primary: false
default: '1'
notnull: true
autoincrement: false
relations:
EEvaluationround:
local: evaluationround_id
foreign: evaluationround_id
左连接语法是否有任何问题,它在日志中抛出以下错误
[Thu Mar 25 07:37:31.544467 2021] [php7:notice] [pid 15834] [client 10.202.9.10:18298] 未知的记录属性/相关组件“
\nalias : EEvaluationround\nforeign : evaluationround_id\nlocal : evaluationround_id\nclass : EEvaluationround\ntype : 0\ntable : Object(EEvaluationroundTable)\nlocalTable : 对象(EEvaluationroundUserTable)\nname : \nrefTable : \nonDelete : \nonUpdate : \ndeferred : \ndeferrable : \nconstraint : \nequal : \ncascade : Array\nowningSide : \nrefClassRelationAlias : \nforeignKeyName : \norderBy : \n” 关于“EEvaluationroundUser”,引用者:
[Thu Mar 25 07:37:31.544608 2021] [php7:error] [pid 15834] [client 10.202.9.10:18298] PHP 致命错误:无法声明类 Swift,因为该名称已在 /home/project/ 中使用代码/symfony/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift.php 第 18 行,引用者:
解决方案
推荐阅读
- typescript - 在类型声明文件中声明模块实例参数
- bash - 如何在启动脚本中设置系统变量
- c# - 组合长字符串的好方法是什么?
- c# - 如何在 C# 中获取 PowerShell 的 Get-Command 的“建议”?
- android - 如何更新蓝牙 LeScanCallback 中的文本视图?
- oracle - 尽管有提示,Oracle 并未在简单查询中使用索引
- c - 将数组传递给函数会更改函数“sizeof(array)”
- svn - 我应该硬包装 SVN 提交消息吗
- plsql - 在 PL/SQL 中的循环中更改数据库动态传递值
- php - 如何在php中更改字体颜色并在函数上添加空格