本文整理汇总了PHP中Parameter::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::save方法的具体用法?PHP Parameter::save怎么用?PHP Parameter::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRequirementParameterSuccess
public function testRequirementParameterSuccess()
{
$parameter = new Parameter();
$parameter->name = "NEEDLE_LENGTH";
$parameter->type = "float";
$parameter->widget = null;
$parameter->value = null;
$parameter->priority = 2;
$parameter->paramable_id = '-1';
$parameter->paramable_type = '';
$this->assertTrue($parameter->save());
}
示例2: actionUpload
public function actionUpload()
{
parent::actionUpload();
$folder = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/upload/';
// folder for uploaded files
$file = $folder . basename($_FILES['uploadfile']['name']);
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
$row = 0;
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($row > 0) {
$model = Parameter::model()->findByPk((int) $data[0]);
if ($model === null) {
$model = new Parameter();
}
$model->parameterid = (int) $data[0];
$model->paramname = $data[1];
$model->paramvalue = $data[2];
$model->description = $data[3];
$model->recordstatus = (int) $data[4];
try {
if (!$model->save()) {
$this->messages = $this->messages . Catalogsys::model()->getcatalog(' upload error at ' . $data[0]);
}
} catch (Exception $e) {
$this->messages = $this->messages . $e->getMessage();
}
}
$row++;
}
} else {
$this->messages = $this->messages . ' memory or harddisk full';
}
fclose($handle);
} else {
$this->messages = $this->messages . ' check your directory permission';
}
if ($this->messages == '') {
$this->messages = 'success';
}
echo $this->messages;
}
示例3: updateParameters
public function updateParameters()
{
$data = Input::get();
$endpoint = EndPoint::find($data['id']);
$parameters = Parameter::where('endpoint_id', '=', $endpoint->id)->delete();
$newParameterList = $data['parameters'];
foreach ($newParameterList as $param) {
$parmeter = new Parameter();
$parmeter->endpoint_id = $endpoint->id;
$parmeter->name = $param['name'];
$parmeter->defaultValue = $param['defaultValue'];
$parmeter->type = $param['type'];
$parmeter->required = $param['required'] === 'true' ? TRUE : FALSE;
$parmeter->save();
$parmeter = $endpoint->parameters()->save($parmeter);
}
return Response::json(array("success" => true, 'message' => 'Successfully modified parameters!'));
}