本文整理汇总了PHP中ModelBase::val方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelBase::val方法的具体用法?PHP ModelBase::val怎么用?PHP ModelBase::val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelBase
的用法示例。
在下文中一共展示了ModelBase::val方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare($db, $data)
{
$this->data = $data;
if ($this->is_admin_form) {
$this->action = sprintf($this->action, $this->data->val($this->id));
$this->del_url = sprintf($this->del_url, $this->data->val($this->id));
}
foreach ($this->fields as $field) {
if (isset($field->name)) {
$field->value = $this->data->val($field->name);
if ($field->type == 'select' && !isset($field->select_data)) {
$field->select_data = ModelBase::select($db, $field->select_table, null, null, null, null, $field->select_label_field);
} elseif ($field->type == 'foreign_key_link') {
$entity = new ModelBase($db);
$entity->table_name = $field->link_table;
$filter = sprintf('%s = ?', $field->link_id_field);
$entity->loadSingleFiltered($filter, [$this->data->val($field->name)]);
$field->link_label = $entity->val($field->link_label_field);
$field->link_url = sprintf($field->link_template, $entity->val($field->link_id_field));
}
}
}
}