我有三个条件对象$c1,$c2,$c3
我想返回所有三个的联合集,即:($c1 || $c2 || $c3)我有一个函数,它需要一个Criteria对象,所以我需要能够返回一个代表$c1、$c2和$c3的联合的criteria。
有谁知道如何做到这一点吗?
发布于 2011-02-21 18:45:08
你可以用标准来做到这一点:
<?php
$c = new Criteria();
$cton1 = $c->getNewCriterion(AuthorPeer::FIRST_NAME, "Leo");
$cton2 = $c->getNewCriterion(AuthorPeer::LAST_NAME, array("Tolstoy", "Dostoevsky", "Bakhtin"), Criteria::IN);
// combine them
$cton1->addOr($cton2);
// add to Criteria
$c->add($cton1);https://stackoverflow.com/questions/5063608
复制相似问题