本文整理汇总了PHP中Dept::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::save方法的具体用法?PHP Dept::save怎么用?PHP Dept::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dept
的用法示例。
在下文中一共展示了Dept::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Simpan Departement
* (New Departement)
*
* @return mixed
*/
public function save()
{
$this->departement->name = Input::get('name');
$this->departement->info = Input::get('info');
$this->departement->uuid = uniqid('New_');
$this->departement->createby_id = Auth::user()->id;
$this->departement->lastupdateby_id = Auth::user()->id;
$this->departement->created_at = new Carbon();
$this->departement->updated_at = new Carbon();
$saved = $this->departement->save() ? true : false;
return Response::json(array('success' => $saved, 'results' => $this->departement->toArray()))->setCallback();
}
示例2: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aDept !== null) {
if ($this->aDept->isModified() || $this->aDept->isNew()) {
$affectedRows += $this->aDept->save($con);
}
$this->setDept($this->aDept);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Dept();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Dept'])) {
$model->attributes = $_POST['Dept'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例4: actionCreate
public function actionCreate()
{
$this->hasPrivilege(Acl::ACTION_CREATE);
$this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
$model = new Dept();
$model_class_name = $model->getClassName();
if (isset($_POST[$model_class_name])) {
$model->attributes = $_POST[$model_class_name];
if ($model->save()) {
Yii::app()->user->setFlash('success', Lang::t('Department saved successfully. Now create the contact person.'));
$this->redirect(Yii::app()->createUrl('users/default/create', array('dept_id' => $model->id, Controller::GET_PARAM_RETURN_URL => $this->createUrl('view', array('id' => $model->id)))));
}
}
$this->render('default/create', array('model' => $model));
}
示例5: create
static function create($vars, &$errors)
{
return Dept::save(0, $vars, $errors);
}
示例6: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aDept !== null) {
if ($this->aDept->isModified() || $this->aDept->isNew()) {
$affectedRows += $this->aDept->save($con);
}
$this->setDept($this->aDept);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
if ($this->sectionsScheduledForDeletion !== null) {
if (!$this->sectionsScheduledForDeletion->isEmpty()) {
SectionQuery::create()->filterByPrimaryKeys($this->sectionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->sectionsScheduledForDeletion = null;
}
}
if ($this->collSections !== null) {
foreach ($this->collSections as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例7: actionAddDept
/**
* Handler for add new dept
*/
public function actionAddDept()
{
$user = $_REQUEST['user'][0];
$sum = $_REQUEST['sum'][0];
$comment = $_REQUEST['comment'][0];
$date = $_REQUEST['date'][0];
$time = $_REQUEST['time'][0];
$attributs = array();
if ($user != '') {
$attributs['user_id'] = $user;
}
if ($sum != '') {
$attributs['sum'] = $sum;
}
if ($comment != '') {
$attributs['comment'] = $comment;
}
if ($date != '' && $time != '') {
$attributs['comment'] = $date . ' ' . $time;
}
if (isset($_REQUEST['id'])) {
$id = $_REQUEST['id'];
$attributs['id'] = $id;
}
$dept = new Dept($attributs);
$dept->save();
$id = $dept->getId();
$this->showResponse(array('status' => true, 'id' => $id));
}