本文整理汇总了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);
}