English 中文(简体)
第2条
原标题:doctrine 2 left join

如何在Doctrine 2中使用――> from(),->leftjoin......

类似情况

select c.* from category left join domande as d on d.category_id = c.id left join age as a on d.age_id = a where a.age > 30 and a.id is not null

i 保持

Fatal error: Uncaught exception  DoctrineORMQueryQueryException  with message  [Semantical Error] line 0, col 63 near  d ORDER BY c.ordine : Error: Identification Variable EntitiesDomanda used in join path expression but was not defined before. 
最佳回答

您可在询问中打字——请注意,在你所问的两个地点,“Domande”和“Domanda”的表述有所不同。 另外,你没有提及按条款分列的文件汇编,但错误信息确实如此。

下面是您在DQL中撰写的问询,并按错误信息中提到的条款列出。

$query = $em->createQuery(
     SELECT c FROM EntitiesCategory LEFT JOIN c.domande d LEFT JOIN d.age a 
     WHERE a.age > 30 AND a.id IS NOT NULL ORDER BY c.ordine );
$results = $query->getResult();
问题回答

暂无回答




相关问题
Doctrine quoting apostrophes

I am using Doctrine ORM for php and Zend MVC. I have a mysql database. When I insert into the database it is escaping quotes. In other-words when I enter <input name="customer_name" value="Test ...

What does mutators and accessors do in Doctrine?

In this document, it explains how to use mutators and accessors in Doctrine, but does not explain what they are. Could anyone explain what mutators and accessors do and what they are? Thanks in ...

Tracking the views of a given row

I have a site where the users can view quite a large number of posts. Every time this is done I run a query similar to UPDATE table SET views=views+1 WHERE id = ?. However, there are a number of ...

Doctrine schema.yml generator

I am pretty new to doctrine. I made two small projects with doctrine for my own but now I am about to create big project for my client. The project will have more than 50 tables. Is there any way of ...

How does Doctrine handle changes to the database schema?

In brief, what happens when you add a column to a table? What happens when you remove one? In more details, suppose you have the following: class User extends Doctrine_Record { public function ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签