- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Doctrine2 QueryBuilder 创建查询。
$qb = $this->getObjectManager()->createQueryBuilder();
$qb->select( array('n', 't', 'c') )
->from('Application\Entity\Notification', 'n')
->leftJoin('n.notificationType', 't')
->leftJoin('n.course', 'c')
->leftJoin('c.studyCourses', 's');
实体类(class)中的相关代码如下所示:
/**
* @ORM\OneToMany(targetEntity="StudyCourses", mappedBy="Course", cascade={"all"})
*/
protected $studyCourses;
实体StudyCourse中的相关代码如下所示:
/**
* @ORM\ManyToOne(targetEntity="Course", inversedBy="studyCourses")
* @ORM\JoinColumn(name="Course", referencedColumnName="Id", nullable=true)
*/
protected $course;
现在,当我尝试运行查询时,我在“”附近遇到语义错误。我认为打印 Doctrine 创建的 SQL 可以为我提供有关此错误的更好信息,但事实上它是:
SELECT n0_.Id AS Id0, n0_.Timestamp AS Timestamp1, n0_.TitleHtml AS TitleHtml2, n0_.ContentHtml AS ContentHtml3, n1_.Id AS Id4, n1_.Created AS Created5, n1_.Updated AS Updated6, n1_.Name AS Name7, c2_.Id AS Id8, c2_.Created AS Created9, c2_.Updated AS Updated10, c2_.Name AS Name11, c2_.Description AS Description12, c2_.Code AS Code13, c2_.ObjectId AS ObjectId14, c2_.IsActive AS IsActive15, n0_.NotificationType AS NotificationType16, n0_.User AS User17, n0_.Department AS Department18, n0_.Study AS Study19, n0_.Course AS Course20, n0_.Category AS Category21, c2_.Language AS Language22 FROM Notification n0_ LEFT JOIN NotificationType n1_ ON n0_.NotificationType = n1_.Id LEFT JOIN Course c2_ ON n0_.Course = c2_.Id LEFT JOIN
它在 LEFT JOIN 之后停止!
任何帮助将不胜感激,因为我真的不知道我做错了什么,也不知道如何解决这个问题。我在互联网上搜索了类似的错误,但到目前为止还没有运气。
最佳答案
尝试至少选择在 select 数组内的 StudyCourses 表中形成 leftJoin 所需的列。首先尝试获取诸如“select( array('n', 't', 'c', 's') )”之类的所有内容。有时,如果您未选择该列,它就会中断。如果这有效,不要获取 StudyCourses 表中的所有列,只需获取 select 中的相关列以形成 leftJoin,例如“s.id”。
希望这有帮助。
干杯!
关于php - Doctrine2 QB OneToMany 连接上的语义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23929593/
我有一个申请。如果我从应用程序中单击供应商保存按钮,则供应商详细信息需要传递给 QB。那可能吗 ?怎么办? 最佳答案 假设您正在谈论 QuickBooks Web Connector - 不。 您必须
因此,我正在尝试将一些非常古老且备受推崇的工程分析 QBasic 4.5 代码移植到 C 中。我正在尝试精确匹配结果,但我发现我不太明白 QB 是如何进行数学计算的。 比如这两行 DIM a AS S
我只想知道 (id = 1) 的学生通过了多少考试。在我的数据库中,id = 1 的学生已经通过了一次测试。 数据库和运行结果在下面的链接中: Capture The GetAvg() methode
我有一个有效的 QBXML 界面,但我似乎无法添加几个 数据项到发票上传(到 QB)。我正在尝试添加 发票日期和 P.O.数字。 QB 返回的错误是: QuickBooks found an erro
我正在尝试使用 Doctrine2 QueryBuilder 创建查询。 $qb = $this->getObjectManager()->createQueryBuilder();
上周我一直在验证我的构建是否正确设置。我一直从 Quickblox 获取 HTTP 状态 422,由于 .我可以肯定地知道 twitter auth 是在我这边正确设置的,同事们已经验证了这一点。我们
我有一系列类似的查询来从数据库中获取大量信息。 它们都具有如下所示的基本设置,只是表格不同。 问题是,对于 $version_ids 中的每个元素,它将为下面的 3 个特定表生成 SELECT * 查
我使用 instructions here 在 PC 上安装了 Python ,在命令下运行,没有管理员凭据提示。 msiexec /a python-3.3.2.msi /qb TARGETDIR=
当我尝试使用 Doctrine 查询生成器执行 STR_TO_DATE mysql 函数时,symfony2 抛出如下异常: Error: Expected known function, got '
我一直在使用从Python发送数据到QB桌面版本。在创建采购订单时,我遇到了这个问题,我已经尝试了很多次,但仍然不知道如何解决这个错误
我一直在尝试使用 Quickblox 应用程序并且一切正常(至少在使用用户帐户登录的范围内......)直到今天下午我开始遇到像这样的令人困惑的用户身份验证错误: 108 606756 日志 [QBC
好吧,所以每个人都认为(并且有充分的理由)海峡 SQL 是魔鬼。这让我们有很多方法可以在我们的代码中放置一个“中间人”来将我们的代码与数据库分开。我现在要说出我收集到的所有信息,希望有人能告诉我我 b
在看似随机的时间进行这项工作有困难。当我进入聊天页面时, Controller 激活,然后立即触发 before addlistener 和 after addlistener console.log
我正在使用 Consolibyte 的 PHP/QB 集成在本地计算机上将客户插入/更新到 QB。 当我最初运行 PHP 脚本以将信息从 mysql 数据库插入到 QB 时,一切顺利——太棒了。 但是
我按照文档操作了三遍以上,但无法接听电话。这是代码: $scope.occupants = [6184, 6186]; $scope.session = QB.webrtc.createNewSess
我是一名优秀的程序员,十分优秀!