本文整理匯總了PHP中Condition::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Condition::create方法的具體用法?PHP Condition::create怎麽用?PHP Condition::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Condition
的用法示例。
在下文中一共展示了Condition::create方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _argToCondition
protected function _argToCondition($arg)
{
if (!$arg instanceof Condition) {
$arg = Condition::create($arg);
if ($this->_prefix) {
$arg->setPrefix($this->_prefix);
}
}
return $arg;
}
示例2: createSelectParams
public static function createSelectParams($condition = null, $order = null, $limit = null)
{
$sql = "";
if (!is_null($condition)) {
$sql .= " WHERE " . Condition::create($condition)->toSql();
} else {
$sql .= " WHERE 1";
}
if ($order) {
$sql .= " ORDER BY " . Helper::orderToSql($order);
}
if ($limit) {
$sql .= " LIMIT " . Helper::limitToSql($limit);
}
return $sql;
}
示例3: _select
public static function _select($condition = null, $order = null, $limit = null)
{
if (is_null(self::$_preloaded)) {
self::$_preloaded = parent::_select();
}
//TODO: $order & $limit processing
if (is_null($condition)) {
return self::$_preloaded;
}
$condition = Condition::create($condition);
$resultSet = [];
foreach (self::$_preloaded as $entry) {
if ($condition->test($entry)) {
$resultSet[] = $entry;
}
}
return $resultSet;
}
示例4: testOrAndOrCondition
public function testOrAndOrCondition()
{
$st = MODEL("SchemaTest");
$or1 = new Sabel_Db_Condition_Or();
$or1->add(Condition::create(EQUAL, "sint", 100));
$or1->add(Condition::create(EQUAL, "sint", 300));
$or2 = new Sabel_Db_Condition_Or();
$or2->add(Condition::create(EQUAL, "sint", 300));
$or2->add(Condition::create(EQUAL, "sint", 500));
$st->setOrderBy("id");
$st->setCondition($or1);
$st->setCondition($or2);
$results = $st->select();
$this->assertEquals(2, count($results));
$this->assertEquals("test5@example.com", $results[0]->email);
$this->assertEquals("test6@example.com", $results[1]->email);
}
示例5: isMatch
/**
* @param $condition
* @return bool
*/
public function isMatch($condition)
{
return Condition::create($condition)->test($this->_fields);
}