I am learning symfony framework. Now I am getting all data from mysql table orders
this way:
$c = new Criteria(); $this->items = OrdersPeer::doSelect($c);
Also I have other table orders_complete
. How can I get data from tables orders
and orders_complete
?
I want to do this query:
SELECT * FROM orders, orders_complete WHERE orders.id = orders_complete.id
If I remember right, with propel you should be able to do something like :
$c = new Criteria(); $orders = OrdersPeer::doSelect($c); foreach($orders as $order) { $complete = $order->getOrderCompletes(); // do something with $order and $complete ... }
This providing that you have defined the two tables relationship within your schema file... Do check the propel documentation regarding this : http://propelorm.org/documentation/04-relationships.html#using-relationships-in-a-query