本文整理汇总了PHP中SQLQuery::addWhereAny方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQuery::addWhereAny方法的具体用法?PHP SQLQuery::addWhereAny怎么用?PHP SQLQuery::addWhereAny使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLQuery
的用法示例。
在下文中一共展示了SQLQuery::addWhereAny方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: whereAny
/**
* Append a WHERE with OR.
*
* @example $dataQuery->whereAny(array("\"Monkey\" = 'Chimp'", "\"Color\" = 'Brown'"));
* @see where()
*
* @param array $filter Escaped SQL statement.
* @return DataQuery
*/
public function whereAny($filter)
{
if ($filter) {
$this->query->addWhereAny($filter);
}
return $this;
}
示例2: augmentSQL
public function augmentSQL(SQLQuery &$query)
{
if (Config::inst()->forClass('Post')->allow_reading_spam) {
return;
}
$member = Member::currentUser();
$forum = $this->owner->Forum();
// Do Status filtering
if ($member && is_numeric($forum->ID) && $member->ID == $forum->Moderator()->ID) {
$filter = "\"Post\".\"Status\" IN ('Moderated', 'Awaiting')";
} else {
$filter = "\"Post\".\"Status\" = 'Moderated'";
}
$query->addWhere($filter);
// Filter out posts where the author is in some sort of banned / suspended status
$query->addInnerJoin("Member", "\"AuthorStatusCheck\".\"ID\" = \"Post\".\"AuthorID\"", "AuthorStatusCheck");
$authorStatusFilter = array(array('"AuthorStatusCheck"."ForumStatus"' => 'Normal'));
if ($member && $member->ForumStatus === 'Ghost') {
$authorStatusFilter[] = array('"Post"."AuthorID" = ?', $member->ID);
}
$query->addWhereAny($authorStatusFilter);
$query->setDistinct(false);
}