本文整理汇总了PHP中Variable::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::setValue方法的具体用法?PHP Variable::setValue怎么用?PHP Variable::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable::setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($relation, array $instances)
{
$term = term($relation);
$letters = up_letter_gen();
$to_project = array();
foreach ($instances as $i) {
if (strcmp($i, '?') == 0) {
$to_project[] = $letters->current();
$term->addVariableByName($letters->current());
} else {
$v = new Variable($letters->current());
$v->setValue($i);
$term->addVariable($v);
}
$letters->next();
}
// all variables have value, no need to generate/iterate candidates
if ($term->readyForResolve()) {
return $this->isTrue($relation, $term->getInstances());
}
/* ---------Have to fill the variables with a candidate value ----------- */
try {
if ($this->isRule($relation)) {
$candidates = $this->instance_generator_for_rule($term);
} else {
$candidates = $this->instance_generator_for_fact($term);
}
} catch (Exception $e) {
echo "no candidates for: \n";
echo " " . $term->toString() . "\n";
return array();
}
//foreach($candidates as $i) print_r($i);
$candidate_table = $this->getRelationTable($term->arity());
foreach ($candidates as $_instances) {
if ($this->isTrue($relation, $_instances)) {
$candidate_table->insert_row_array($_instances, TRUE);
}
}
return $candidate_table->project($to_project)->tuples();
}
示例2: setVariable
public function setVariable()
{
try {
if (fRequest::get('remove', 'boolean')) {
$variable = new Variable(fRequest::get('name'));
$variable->delete();
fMessaging::create('success', 'Variable removed successfully.');
} else {
try {
$variable = new Variable(fRequest::get('name'));
} catch (fNotFoundException $e) {
$variable = new Variable();
$variable->setName(fRequest::get('name'));
}
$variable->setValue(fRequest::get('value'));
$variable->store();
fMessaging::create('success', 'Variable set successfully.');
}
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
}
fURL::redirect(Util::getReferer());
}