I often start to code basing on the desired call.
In this case, the caller should say something like that :
$this->orm(array(
// Base query (corresponding to your example)
// Normally called by your context call
'select' => array('id','name','published','created_by'),
// Force the Filter value
'filter' => array(
'created_by' => array(
'value' => 12
)
),
// UNION : Simple version (nameless)
'union' => array(
// TODO : Missing in ORM
'from' => 'a',
'filter' => array(
'type' => array(
// TODO : Missing in ORM
'sql' => "a.type <> 'bi' AND a.type <> 'pv'"
)
)
),
// UNION : Namespaced version
'union' => array(
'myUnion1' => array(
'from' => 'a',
'filter' => array(
'type' => array(
'sql' => "a.type <> 'bi' AND a.type <> 'pv'"
)
)
)
)
));
As you can see, it is missing some parts in ORM before to achieve this union:
- Create the @sql parameter of the filter directive for overriding the query condition.
- Handle 'from' directly in the union directive function, or create a new 'from' directive in ORM
Got it ?