本文整理匯總了PHP中Parameter::toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parameter::toString方法的具體用法?PHP Parameter::toString怎麽用?PHP Parameter::toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Parameter
的用法示例。
在下文中一共展示了Parameter::toString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: beforeSave
function beforeSave(&$data, &$params, $mode)
{
foreach ($this->params_fields as $params_field) {
if (isset($data[$params_field]) and is_array($data[$params_field])) {
$p_obj = new Parameter($data[$params_field]);
$data[$params_field] = $p_obj->toString();
}
}
if (isset($data['extras']) and is_array($data['extras'])) {
$base_string = new Base64($data['extras']);
$data['extras'] = $base_string->encode();
}
if (array_key_exists('alias', $data) and empty($data['alias']) and !empty($data['title'])) {
$count = 1;
$test = $alias = Str::slug($data['title']);
redo:
$exists = $this->find('first', array('fields' => array($this->pkey), 'conditions' => array('alias' => $test)));
if (!empty($exists)) {
$count++;
$test = $alias . $count;
goto redo;
}
$data['alias'] = $test;
}
if ($mode == 'create' and in_array('user_id', $this->table_fields) and !isset($data['user_id'])) {
$user = Base::getUser();
$data['user_id'] = $user['id'];
}
}