本文整理匯總了PHP中ModelBase::loadSingleFiltered方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModelBase::loadSingleFiltered方法的具體用法?PHP ModelBase::loadSingleFiltered怎麽用?PHP ModelBase::loadSingleFiltered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ModelBase
的用法示例。
在下文中一共展示了ModelBase::loadSingleFiltered方法的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));
}
}
}
}