本文整理汇总了PHP中Criterion::addOr方法的典型用法代码示例。如果您正苦于以下问题:PHP Criterion::addOr方法的具体用法?PHP Criterion::addOr怎么用?PHP Criterion::addOr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criterion
的用法示例。
在下文中一共展示了Criterion::addOr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSelectFiltered
public static function doSelectFiltered(Criteria $criteria, $con = null)
{
$criteria->add(VSpecPeer::PARENT, 1, Criteria::IN);
$c3 = $criteria->getCriterion(VSpecPeer::PARENT);
$c4 = new Criterion($criteria, VSpecPeer::PARENT, 7, Criteria::IN);
$c5 = new Criterion($criteria, VSpecPeer::PARENT, 0, Criteria::IN);
$c4->addOr($c5);
$c3->addOr($c4);
$tmp_depts = VSpecPeer::doSelect($criteria);
$depts = array();
foreach ($tmp_depts as $key => $val) {
$pi = $val->getParentalIndex();
$prefix = '';
for ($i = 0; $i < $val->level - 1; $i++) {
$prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue();
}
$val->setCode($prefix . $val->getCode());
$val->setDescription($prefix . $val->getDescription());
$depts[$pi] = $val;
}
ksort($depts);
$result = array();
foreach ($depts as $r) {
$result[] = $r;
}
return $result;
}
示例2: addOr
public function addOr(Criterion $criterion)
{
if ($criterion instanceof KalturaCriterion) {
$criterion->setSelfConjunction(self::ODER);
$criterion->setParentCriterion($this);
}
return parent::addOr($criterion);
}
示例3: addClauses
/**
* add inner criteria for criterions
* ----------------- IMPORTANT -----------------
* for this to work - we have to change the access modifier of the Creterion::getClauses() function from private to public
* It's in the Criteria.php file under
* /symfony/vendor/propel/util/Criteria.php
*/
private function addClauses(Criteria $criteria_to_filter, Criterion $filter_criterion, Criterion $crit)
{
$conjunctions = $filter_criterion->getConjunctions();
if (count($conjunctions) < 1) {
return;
}
$clauses = $filter_criterion->getClauses();
$i = 0;
foreach ($clauses as $clause) {
$new_crit = $criteria_to_filter->getNewCriterion($clause->getTable() . "." . $clause->getColumn(), $clause->getValue(), $clause->getComparison());
$conj = @$conjunctions[$i];
if ($conj == Criterion::UND) {
$crit->addAnd($new_crit);
} elseif ($conj == Criterion::ODER) {
$crit->addOr($new_crit);
}
$i++;
}
}
示例4: addHiddenSearch
/**
* 增加默认的搜索条件
*
* @param string|Criterion $dbColName
* @param string $value
* @param Watt_Util_Grid_Searchs::Const $type
*/
public function addHiddenSearch($dbColName, $value = null, $comparison = self::EQUAL, $isOr = false)
{
/**
* 这样将覆盖同 $dbColName 的条件
*/
//$this->_criteria->add( $dbColName, $value, $type );
/**
* 这样将不覆盖同 $dbColName 的条件
*/
if ($dbColName instanceof Criterion) {
$newCriterion = $dbColName;
} else {
$newCriterion = $this->_criteria->getNewCriterion($dbColName, $value, $comparison);
}
if ($this->_hidden_criterion) {
//$this->_hidden_criterion->addAnd( $newCriterion ); // _hidden_criterion 都必须是 and //错误判断,不仅仅如此
if ($isOr) {
$this->_hidden_criterion->addOr($newCriterion);
} else {
$this->_hidden_criterion->addAnd($newCriterion);
}
} else {
$this->_hidden_criterion = $newCriterion;
}
}
示例5: addClauses
/**
* add inner criteria for criterions
* ----------------- IMPORTANT -----------------
* for this to work - we have to change the access modifier of the Creterion::getClauses() function from private to public
* It's in the Criteria.php file under
* /symfony/vendor/propel/util/Criteria.php
*/
private function addClauses(Criteria $criteriaToFilter, Criterion $filterCriterion, Criterion $criterion)
{
$conjunctions = $filterCriterion->getConjunctions();
if (count($conjunctions) < 1) {
return;
}
$clauses = $filterCriterion->getClauses();
$i = 0;
foreach ($clauses as $clause) {
if ($clause instanceof KalturaCriterion && !$clause->isEnabled()) {
continue;
}
/* @var $clause Criterion */
$newCriterion = $criteriaToFilter->getNewCriterion($clause->getTable() . "." . $clause->getColumn(), $clause->getValue(), $clause->getComparison());
$conj = @$conjunctions[$i];
if ($conj == Criterion::UND) {
$criterion->addAnd($newCriterion);
} elseif ($conj == Criterion::ODER) {
$criterion->addOr($newCriterion);
}
$i++;
}
}
示例6: addOr
/**
* Append an OR Criterion onto this Criterion's list.
* @return Criterion
*/
public function addOr(Criterion $criterion)
{
$this->hasOr = true;
return parent::addOr($criterion);
}