本文整理汇总了PHP中JDatabaseQuery::orWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseQuery::orWhere方法的具体用法?PHP JDatabaseQuery::orWhere怎么用?PHP JDatabaseQuery::orWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseQuery
的用法示例。
在下文中一共展示了JDatabaseQuery::orWhere方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOrWhere
/**
* Tests the JDatabaseQuery::orWhere method.
*
* @return void
*
* @since 3.6
*/
public function testOrWhere()
{
$this->assertThat($this->_instance->where('foo = 1')->orWhere('bar = 2'), $this->identicalTo($this->_instance), 'Tests chaining.');
$this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(foo = 1) OR ' . PHP_EOL . '(bar = 2)'), 'Tests rendered value.');
// Add another set of where conditions.
$this->_instance->orWhere(array('baz = 3', 'goo = 4'));
$this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(' . PHP_EOL . '(foo = 1) OR ' . PHP_EOL . '(bar = 2)) OR ' . PHP_EOL . '(baz = 3 AND goo = 4)'), 'Tests rendered value after second use and array input.');
// Add another set of where conditions with some different glue.
$this->_instance->orWhere(array('faz = 5', 'gaz = 6'), 'XOR');
$this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(' . PHP_EOL . '(' . PHP_EOL . '(foo = 1) OR ' . PHP_EOL . '(bar = 2)) OR ' . PHP_EOL . '(baz = 3 AND goo = 4)) OR ' . PHP_EOL . '(faz = 5 XOR gaz = 6)'), 'Tests rendered value after third use, array input and different glue.');
}