You need to specify this in your schema:
City:
columns:
city:
type: string(255)
Travel:
columns:
id_city_departure:
type: integer
id_city_arrival:
type: integer
relations:
DepartureCity:
class: City
local: id_city_departure
foreign: id
ArrivalCity:
class: City
local: id_city_arrival
foreign: id
Then for your query:
$q = Doctrine_Query::create()
->from('Travel trav')
->leftJoin('trav.DepartureCity dep')
->leftJoin('trav.ArrivalCity arr');
On Thu, Dec 31, 2009 at 1:40 PM, dziobacz <[email protected]> wrote:
> CITIES:
> id_city
> city
>
> TRAVEL:
> id_travel
> id_city_departure
> id_city_arrival
>
> How can I make query in that case to get in one row name of departure
> city and name of arrival city ? I have tried something like that but
> it doesn't work:
>
> $q = Doctrine_Query::create()
> ->from('Travel trav')
> ->innerJoin('trav.Cities dep ON dep.id_city = trav.id_city_departure')
> ->innerJoin('trav.Cities arr ON arr.id_city = trav.id_city_arrival');
>
> return $q->fetchArray();
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en.