FindAll() with multiple joins?

Hi everyone

first of all, sorry for my poor english, it’s not my mother language.

So, i have 3 models and their related tables:

  • OrderLine (that has a foreign key: orderID)

  • Order (that has a foreign key: personID)

  • Person

one persone can sent an order, and an order can contains multiple lines. The relations are well defined in my models.

I’m trying to make some statistics about who purchased what. But i have a problems doing that. I would like to be able to search for an article purchased by someone.

The problem is that i can’t link the person… My $criteria condition is something like “IDArticle = 14 AND iDPerson.ID = 40” and in my find() method i do:

$multipleLines = OrderLinee::model()->with(‘iDOrder’,‘iDOrder.iDPerson’)->together()->findAll($criteria);

but that seems not to work.

So the question is: how can i join a table that is related by a related table? I’m not sur if i’m saying it well, i can join a table easyly, but that joined table contains another relation that i would like to join…

Thanks a lot!

forget it, i’m stupid ><. the condition has to be like

"DArticle = 14 AND iDPerson = 40"