本文整理汇总了PHP中Condition::addOr方法的典型用法代码示例。如果您正苦于以下问题:PHP Condition::addOr方法的具体用法?PHP Condition::addOr怎么用?PHP Condition::addOr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Condition
的用法示例。
在下文中一共展示了Condition::addOr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCondition
/**
* @group count
* @covers Query::getQuery
*/
function testCondition()
{
$c = new Condition();
$c->add('fun', 'good');
$c->addOr('foo', 'bar');
$c->add('awesome', array('good', 'awesome', 'nice'));
$c->addOr('do', 'stuff');
$c2 = new Condition('bah', 'blacksheep');
$c2->addOr('empty', null);
$c->addOr($c2);
// shouldn't do anything
$c->add(null);
$stmnt = $c->getQueryStatement();
$stmnt->setConnection(DBManager::getConnection());
$q = "\n\t`fun` = 'good'\n\tOR `foo` = 'bar'\n\tAND `awesome` IN ('good','awesome','nice')\n\tOR `do` = 'stuff'\n\tOR (\n\t`bah` = 'blacksheep'\n\tOR `empty` IS NULL )";
$this->assertEquals($q, $stmnt->__toString());
}
示例2: addOr
/**
* Shortcut to adding an OR statement to the Query's WHERE Condition.
* @return Query
* @param $column Mixed
* @param $value Mixed[optional]
* @param $operator String[optional]
* @param $quote Int[optional]
*/
function addOr($column, $value = null, $operator = self::EQUAL, $quote = null)
{
if (func_num_args() === 1) {
$this->_where->addOr($column);
} else {
$this->_where->addOr($column, $value, $operator, $quote);
}
return $this;
}