tags:

views:

464

answers:

1

I'm trying to create a UNION query using the Propel ORM e.g

$criterion1 UNION $criterion2

anyone knows how to do this?

A: 

You cannot create a union query using Criteria. Instead, you can create the SQL string yourself, and use it to hydrate the objects. If you still want to use Criteria to build both parts of the union query, you can call BasePeer::createSelectSql(Criteria $criteria, array &$params). This will return an SQL string with ? in the places of the values that need to be set by the PDO layer. The second parameter is an array that will be filled with these parameters (which is why you pass it by reference). You can pass this to the PDOStatement::execute(array $params) function.

Jan Fabry