Go to Google Groups Home    doctrine-user
Re: [doctrine-user] Using a join in query with no relation in schema

Tom Boutell <t...@punkave.com>

You shouldn't need a relation to do a "from with commas" implicit join
like this one. Your code would work just the way you wrote it. Except
that in your schema, cars is plural, and in your code it is singular.
You should change cars to Car in your schema.yml.

You should also be consistent about your capitalization although that
might not be a dealbreaker.

2009/7/7 Chtipepere <chtipep...@gmail.com>:

> Hi everybody,
> I'm quite new to Doctrine, and I'm trying that :

> return Doctrine_Query::create()
>  ->select('News.*, Car.*')
>  ->from('News, Car')
>  ->where('News.object = ? and Car.id = News.object_id', 'Car')
>  ->execute();

> schema.yml:
> cars:
>  name:  string

> news:
>  title:  string
>  object:  string
>  objec_id: string

> In the schema, there's no relation between news and car, because I
> want to use news for other object (like moto for exemple), and I'm not
> that good to create a behavior.

> Here's the error :
> "Car" with an alias of "Car" in your query does not reference the
> parent component it is related to.

> If anyone can help... ?

> thanks in advance to everyone.

> πR

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com