UNION query with Propel ORM

前端 未结 2 1064
不思量自难忘°
不思量自难忘° 2021-01-18 12:11

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

$criterion1 UNION $criterion2

Does anyone know how to do this?

2条回答
  •  無奈伤痛
    2021-01-18 12:29

    Two solutions come to mind. Firstly, the trivial approach is to run two separate calls and then use array_merge to glue them together. Depending on your use-case, this may not be as time-expensive as you think.

    Also, if you are stuck writing the query, write a view with the query you want, and then put that in your Propel model. I had a bunch of very complicated master-detail screens in Propel/symfony 1.x, and this approach worked a treat. It does go slightly against the philosophy of using an ORM, but hey, it's fun to break the rules once in a while! :)

提交回复
热议问题